Post

Replies

Boosts

Views

Activity

Sonoma temp folder permission alert breaks XCUITest
I used to be able to test my app by making it save files to a temp folder (with a file URL created in the XCUITest runner), and then comparing them to files in the test bundle, but in Sonoma, this will issue a blocking "[App name] wants to access files from other apps" security alert, which has to be dismissed manually. This breaks the test flow. It kind of makes sense, as I'm trying to save from the app to the temp folder of another app (the test runner.) Is there any way around this? Is there a temp folder that both applications can access without security alerts?
3
0
770
Oct ’23
App Store Connect Errors for embedded dylibs
I have a Mac app that was accepted to the App Store when I built it using Xcode 13 (with code signing set to automatic, just like I do now), but with Xcode 14.2 I keep getting mails with ITMS-90288: Invalid Code Signing Entitlements and TMS-90286: Invalid Code Signing Entitlements, two very similar errors for each embedded dynamic library. The exact wording is this: TMS-90288: Invalid Code Signing Entitlements - The entitlements in your app bundle signature do not match the ones that are contained in the provisioning profile. According to the provisioning profile, the bundle contains a key value that is not allowed: '(My team id).' for the key 'com.apple.application-identifier' in 'Spatterlight.app/Contents/Frameworks/libc64diskimage.dylib' ITMS-90286: Invalid Code Signing Entitlements - Your application bundle's signature contains code signing entitlements that are not supported on macOS. Specifically, value '(My team id).' for key 'com.apple.application-identifier' in 'Spatterlight.app/Contents/Frameworks/libc64diskimage.dylib' is not supported. This value should be a string starting with your TEAMID, followed by a dot '.', followed by the bundle identifier . The post https://developer.apple.com/forums/thread/710598 seems to indicate that dylibs shouldn't have entitlements at all, but apparently Xcode is adding them anyway, making the app unacceptable to the App Store. How do I fix this?
5
0
1.8k
Feb ’23
NSTextView in NSScrollView with magnification crashes on resize
I have an NSTextView inside an NSScrollView with magnification. Zooming in with a pinch-and-zoom gesture works fine, but if I then resize the window while zoomed in, it will eventually crash with the error The window has been marked as needing another Display Window pass, but it has already had more Display Window passes than there are views in the window. It does not always happen immediately, sometimes you have to keep resizing for a while to trigger it. I have made a video illustrating the problem here: youtu.be/M_JRQI2oDaY The original code is here: https://github.com/angstsmurf/spatterlight/tree/helpviewtest (The branch helpviewtest is a cut down test case created for this problem.)
1
0
1.3k
Mar ’21
CGWindowListCreateImage renders wrong background for off-screen image
Capturing an image of an off-screen window with CGWindowListCreateImage is a common way to create QuickLook-style zoom-in animations, but seems to give the wrong background colour, slightly whiter than the actual window has when it is shown onscreen. This causes a flash at the end of the animation which kind of ruins the effect. Does anyone have any idea why this happens and what can be done about it? If I set the window appearance to textured in Interface Builder this problem goes away, but then I have the problem that the window looks different (darker) than other windows in the app. I can set the window background to a custom color that makes it match the others windows, but then it still looks off in older macOS versions. I made a sample project that illustrates the problem here: https://github.com/angstsmurf/WindowCaptureTest.
0
0
809
Nov ’21
Core Spotlight on macOS: index extension?
I've implemented Core Spotlight indexing of my app's Core Data without an index extension (CSIndexExtensionRequestHandler), and it seems to be working fine. Would it still be useful to have one? It is described in the documentation, but I'm not sure how to implement things like reindexAllSearchableItems for Core Data. The Showcase App Data in Spotlight sample code associated with the WWDC21 session does not have an index extension, or override the default reindexAllSearchableItems method of NSCoreDataCoreSpotlightDelegate. Does that mean that this is no longer needed?
0
0
824
Oct ’21
Core Spotlight: Best practice for deleting searchable items
I've implemented Core Spotlight indexing of the Core Data in my macOS app, using NSCoreDataCoreSpotlightDelegate, and it seems to be working. Any new or changed Core Data objects and attributes seem to be added to the index automatically and immediately, but searchable items for deleted objects won't be automatically removed. I guess this is working as expected? I've implemented the willSave: method in the relevant NSManagedObject subclasses, where I check the deleted property and run deleteSearchableItemsWithIdentifiers on the default Searchable Index. I also delete searchable items for deleted Core Data objects in my QuickLook extension's preparePreviewOfSearchableItemWithIdentifier method. I suppose what I'm asking is: Am I understanding this right and is this the best way to do it?
0
0
832
Oct ’21
NSTextView always uses system language when hyphenating?
It seems to me that English texts will get better hyphenation if the system language in macOS is set to English. It is hard to be sure, but I think that when my system is set to Swedish, I see a lot more hyphenations like "somet-hing". This is on macOS Big Sur, in an NSTextView with hyphenation switched on by setting hyphenationFactor to 1 on an NSParagraphStyle object in an NSAttritributedString, not a web view or anything like that. The application is not localized, so the app language is English. Setting NSAccessibilityLanguageTextAttribute to "en-US" seems to have no effect. I'd like to know if anyone can confirm this, and if so, is there anything to do about it?
2
0
906
May ’21
Setting preferredContentSize of QLPreviewingController breaks auto resizing
Following the answer here - https://stackoverflow.com/questions/65633750/set-quicklook-window-size-when-previewing-with-qlpreviewingcontroller-preparepre/, I set the preferredContentSize of the QLPreviewingController. This changes the window size as intended, but also seems to break subsequent auto resizing of all subviews. After setting it, the content will no longer track the preview window size when the user resizes it manually or enters fullscreen. Any attempts to set view sizes, resizing masks or constraints programmatically after setting the preferredContentSize property will cause errors like NSServiceViewControllerWindow ... attempted to set frame of... from {...} to {...} and got {...}; set breakpoint on -[NSViewServiceMarshal actualFrame:differsFromSpecifiedFrame:oldFrame:ofWindow:] to catch this and have no visible effect. Setting the breakpoint only tells me that the error is caused by trying to change the size of a view.
2
0
1.3k
Feb ’21
Extension always wants to migrate core data store and alway fails
I am trying to write a thumbnail provider extension (on macOS) that accesses the Core Data store of the main application, shared via an app group, to find images to base icon thumbnails on. This worked fine until I added one attribute to the Core Data model. Now the extension always crashes with An error occurred during persistent store migration and attempt to write a readonly database. Creating a new default model version and deleting the Core Data Store doesn't help. Somehow the thumbnail still thinks that the store written by the main application uses a different model, which makes no sense to me. If I set shouldMigrateStoreAutomatically to NO, I get The managed object model version used to open the persistent store is incompatible with the one that was used to create the persistent store. If I set readOnly = YES on the NSPersistentStoreDescription, I get The file couldn’t be saved because you don’t have permission. Original code is here:  https://github.com/angstsmurf/spatterlight/blob/quicklook/SpatterlightThumbnails/ThumbnailProvider.m
1
0
1.3k
Feb ’21
Access Core Data from extension without provisioning profile on macOS?
I'd like to add a Quick Look extension to my program, but in order to be useful, it would have to access the Core Data stack, which seems to require me to add an App Group and a provisioning profile to the project. Until now, it has been possible for anyone to download the project from Github - https://github.com/angstsmurf/spatterlight and compile and run it out of the box. All project targets are set to Team: None and Sign to Run Locally. If I add my provisioning profile to the project, this will no longer work. They will have to create and add their own provisioning profile and change the Signing & Capabilities settings on each of the 26 targets (there seems to be no way to do them all at once). And the profile will have to be renewed every year. My question is, have I understood this correctly? Is such a major change necessary for what amounts to accessing a file inside the program's own bundle (and another in its Application Support folder.) Is there another way? Is it worth it?
5
1
1.6k
Jan ’21
Making macOS VoiceOver only speak visible text in NSTextView
I have an editable NSTextView in a scrollview, and when the user selects it, I want VoiceOver to read the text visible on the screen, not start from the very top of the (off-screen) text. Does anyone have an idea how to accomplish this seemingly simple task? If I change the role of the text view to NSAccessibilityNavigableStaticText, it will only read the visible text most of the time, but this breaks text entry. If I try to roll my own accessibility element, both the text navigation and the text entry breaks. Alternatively, is there a way to detect when the accessibility cursor moves to the textview, so that I can interrupt the VoiceOver speech with my own announcement?
0
1
650
Dec ’20