I'm using the SwiftUI .fileImporter() modifier to present a file open panel to the user, and then I access the returned file URL using String(contentsOf:encoding:). Then I get an error, "The file “order_history.csv” couldn’t be opened because you don’t have permission to view it."
The thing is, my app (recently created in Xcode 16.1 beta from macOS template) has the User Selected File entitlement set to "Read Only." It should allow reading such a file, should it not?
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I'm trying to get the CoreDataCloudKitShare example to work, but having trouble. The first error I see when running the InitializeCloudKitSchema target (on macOS) is the following:
error: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _performSetupRequest:]_block_invoke(1242): <NSCloudKitMirroringDelegate: 0x60000229c0f0>: Failed to set up CloudKit integration for store: <NSSQLCore: 0x15b807830> (URL: file:///Users/rmann/Library/Application%20Support/InitializeCloudKitSchema/CoreDataStores/Private/private.sqlite)
<CKError 0x600001311290: "Partial Failure" (2/1011); "Failed to modify some record zones"; uuid = 3E1B1380-AE1C-4B14-97A8-7F60B4A8F3EF; container ID = "iCloud.com.example.CoreDataCloudKitShareH6F2W964VK"; partial errors: {
com.apple.coredata.cloudkit.zone:__defaultOwner__ = <CKError 0x60000132f810: "Permission Failure" (10/2007); server message = "Invalid bundle ID for container"; op = F3987848B25CEED7; uuid = 3E1B1380-AE1C-4B14-97A8-7F60B4A8F3EF>
}>
I see a database in the Dashboard with that container ID, but don't know what it means by "Invalid bundle ID for container". I've seen several other posts about this across the web, and the only answer is ever "seems to be an Apple issue, wait a bit."
Topic:
App & System Services
SubTopic:
iCloud & Data
The SwiftUI templates provided by Xcode typically create an in-memory store for preview purposes. I started from one of these templates and added the necessary code for working with CloudKit shares, but now the existing preview store creation gets runtime errors I'm struggling to understand.
The ultimate error is:
FAULT: NSInternalInconsistencyException: Unsupported feature in this configuration; {
store = "<NSSQLCore: 0x12e26b170> (URL: file:///dev/null)";
}
There are other things in the log like:
warning: Multiple NSEntityDescriptions claim the NSManagedObject subclass 'Trip' so +entity is unable to disambiguate.
This might be due in part to the normal full stack being instantiated during a unit test, but that was the only way I could step through the code to try to see what was causing the SwiftUI preview to crash.
I can't build the full core data stack as normal, because then the unit tests and previews pollute the real store.
Topic:
App & System Services
SubTopic:
iCloud & Data
Every time I visit these forums, a banner is displayed at the top asking me to opt-in to notifications. I click "opt-in," the banner disappears, and no notifications are sent.
If I visit my forum profile, it says my browser isn't allowing notifications:
If I look in Settings->Websites, in the list of "These websites have asked for permission to show alerts in Notification Center," there are no apple.com websites whatsoever, including developer.apple.com. "Allow websites to ask for permission to send notifications" is checked, and I have many other websites in that list.
I consider this to be a bug in Safari, but maybe it’s an issue with the forum itself (although I doubt it). I've submitted a Radar for it, but haven't heard anything back (I never do).
EDIT: I realize I should've put this in another category, but it won't let me change that now.
Topic:
Developer Tools & Services
SubTopic:
Developer Forums
Tags:
Forums Feedback
User Notifications
Safari
Six months ago I wrote FB14122473, detailing how the built-in CDC (or FTDI) VCP serial port driver is limited to 3 Mbps or less. Thing is, there are some FTDI devices that can do 12 Mbps (maybe more), and I have devices I need to communicate with at 4 Mbps. I had to use the FTDI SDK to be able to communicate with these.
I was hoping this post might help draw attention to that bug report.
Topic:
App & System Services
SubTopic:
Hardware
I have a view that lets the user position and size a bunch of subviews. I use .frame() and .position() to accomplish this.
Right now, if the user resizes the window, the views stay where they are, anchored to the top-left corner. What I'd like is for the views to scale as a whole with window, maintaining their relative position, and their aspect ratios.
I can apply .scaleEffect(_:anchor:) to the containing view, and it scales them the way I want, but I'm not sure how to tie it to the window.
My first thought is to use a GeometryReader, but I don't really know what the "original" size would have been in order to compute a scale factor.
How else might I accomplish this?
Topic:
UI Frameworks
SubTopic:
SwiftUI
I’ve been having a heckuva time getting macOS (Catalina) to let my app open the associated -wal and -shm files. Googling for answers, it seems macOS should already know about these, but if not, I can create NSIsRelatedItemType additions. But that didn't seem to work for me:
Is there something more I need to do?
If I put the main SQLite file to open inside the app's container, then SQLite can open the associated files just fine.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>SQLiteDocument</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>LSItemContentTypes</key>
<array>
<string>org.sqlite.sqlite3</string>
</array>
<key>NSDocumentClass</key>
<string>$(PRODUCT_MODULE_NAME).Document</string>
</dict>
		<dict>
				<key>CFBundleTypeExtensions</key>
				<array>
						<string>sqlite-shm</string>
						<string>sqlite-wal</string>
						<string>sqlite-journal</string>
				</array>
				<key>CFBundleTypeName</key>
				<string>Support Type</string>
				<key>CFBundleTypeRole</key>
				<string>Editor</string>
				<key>NSIsRelatedItemType</key>
				<true/>
		</dict>
</array>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSMainStoryboardFile</key>
<string>Main</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.database</string>
<string>public.data</string>
</array>
<key>UTTypeDescription</key>
<string>SQLite3</string>
<key>UTTypeIcons</key>
<dict/>
<key>UTTypeIdentifier</key>
<string>org.sqlite.sqlite3</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>sqlite</string>
</array>
</dict>
</dict>
</array>
<key>UTImportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.database</string>
<string>public.data</string>
</array>
<key>UTTypeDescription</key>
<string>SQLite3</string>
<key>UTTypeIcons</key>
<dict/>
<key>UTTypeIdentifier</key>
<string>org.sqlite.sqlite3</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>sqlite</string>
</array>
</dict>
</dict>
</array>
</dict>
</plist>
I'm developing a little USB device for use with macOS, and the name includes the non-ASCII character ū:
LATIN SMALL LETTER U WITH MACRON
Unicode: U+016B, UTF-8: C5 AB
My source file is UTF-8 encoded, but as I understand it, USB uses UTF-16LE encoding for all its strings.
GCC (which I'm using to compile the code for the device) doesn't implement the \u unicode point escape. So I tried "productname\xc5\xab", which causes USB Prober to report the Product String as "productname\u016b".
Is that just USB Prober not properly rendering the string? Or am I still not encoding it correctly?
For years I've poked at a little personal project, an electronic schematic capture app. It's basically a specialized version of something like Illustrator or Omnigraffle, in that you create graphical objects from primitives, instantiate them onto the canvas, and connect them with polylines.
I'm very new to SwiftUI, but I'm wondering if it makes sense to build a new custom view to handle drawing this canvas as a "native" SwiftUI view. I know it's possible to wrap NSViews in SwiftUI, but if SwiftUI can handle it, I'd like to just reimplement it.
There are a number of requirements that complicate things:
This view lives inside a scroll view (or at least, it has bounds that usually extend beyond the window).
The view contains custom graphics and text.
Some graphical elements span large portions of the canvas (e.g. the poly lines connecting components).
The number of individual elements can be quite high (performance concerns). Quadtrees are often used to help with this.
It zooms
Marquee-selection
Mouse down, drag, and up changes the model in significant and varied ways.
Hovering can change appearance of some items.
Can SwiftUI handle all this? I tried to find an example or documentation, but was not having much luck. Almost everything is iOS-focused, so precise and nuanced mouse handling is uncommon.
I’m writing an app that, among other things, displays very large images (e.g. 106,694 x 53,347 pixels). These are GeoTIFF images, in this case containing digital elevation data for a whole planet. I will eventually need to be able to draw polygons on the displayed image.
There was a time when one would use CATiledLayer, but I wonder what is best today. I started this app in Swift/Cocoa, but I'm toying with the idea of starting over in SwiftUI (my biggest hesitation is that I have yet to upgrade to Big Sur).
The image data I have is in strips, with an integral number of image rows per strip. Strips are not guaranteed to be contiguous in the file. Pixel formats vary, but in the motivating use case are 16 bits per pixel, with the values signifying meters. As a first approximation, I can simply display these values in a 16 bpp grayscale image.
Is the right thing to do to set up a CoreImage pipeline? As I understand it that should give me some automatic memory management, right?
I’m hoping to find out the best approach before I spend a lot of time going down the wrong path.
Is there documentation describing the semantics of a Metal CIKernel function?
I have image data where each pixel is a signed 16-bit integer. I need to convert that into any number of color values, starting with a simple shift from signed to unsigned (e.g. the data in one image ranges from about -8,000 to +20,000, and I want to simply add 8,000 to each pixel's value).
I've got a basic filter working, but it treats the pixel values as floating point, I think. I've tried using both sample_t and sample_h types in my kernel, and simple arithmetic:
extern "C"
coreimage::sample_h
heightShader(coreimage::sample_h inS, coreimage::destination inDest)
{
coreimage::sample_h r = inS + 0.1;
return r;
}
This has an effect, but I don't really know what's in inS. Is it a vector of four float16? What are the minimum and maximum values? They seem to be clamped to 1.0 (and perhaps -1.0). Well, I’ve told CI that my input image is CIFormat.L16, which is 16-bit luminance, so I imagine it's interpreting the bits as unsigned? Anyway, where is this documented, if anywhere (the correspondence between input image pixel format and the actual values that get passed to a filter kernel)?
Is there a type that lets me work on the integer values? This document - https://developer.apple.com/metal/MetalCIKLReference6.pdf implies that I can only work with floating-point values. But it doesn't tell me how they're mapped.
Any help would be appreciated. Thanks.
In my macOS SwiftUI app I have a list of "layers" on the left. Clicking on a layer focuses it on the right for acting upon. Each link has a little eye icon that's used to toggle visibility of that layer in the view to the right.
I'd like to be able to click on that eye button without selecting the layer or activating it. Is that possible?
As of 11.3, DocumentGroup defaults to showing the open panel (From the release notes: "DocumentGroup apps now show an Open panel on launch, even when iCloud isn’t in use. (66446310).") Seems like it was considered a bug before that it didn't.
Thing is, I don't like this behavior and don't want it, especially while I'm working on my app. I want to automatically create a new document. Is there any way to set that?
As in the locked question here - https://developer.apple.com/forums/thread/674534, I'm constantly running into this error:
Compiling failed: 'main' attribute cannot be used in a module that contains top-level code
Once it starts, it's not clear how to stop it. No changes were made to my AppDelegate (It's a mostly-UIKit app that I'm adding some SwiftUI views to).
It compiles just fine with a regular build, but the SwiftUI preview can't build it. This is proving to be a real hindrance.
I can sometimes clear the condition by cleaning build and test results, and relaunching Xcode. But not always.
I filed FB9104575 and included the diagnostics.
I just created a new macOS app project in Xcode 13 beta. SwiftUI, unit tests, no Core Data.
I just noticed that it does not add the traditional "Products/MyApp.app" group and file, and I can't figure out how to add those via the UI.
At least one solution online edits the pbxproj file directly; I'd rather not do that.
Is there any sanctioned way to add this? Is not having it a bug?