Post

Replies

Boosts

Views

Activity

Read Extended Attributes with Finder Sync Extension
I'm working on adding a finder sync extension to an app. The app is not sandboxed. In essence, the app is operating on files located in folders that the user chooses, the app stores the status information in an extended attribute for each file. The extension needs to monitor these folders and and assign a badge according to the state indicated in the extended attribute. Everything is working fine, I can get the app and extension to communicate which folders to watch, I can manipulate the files with the app, setting the extended attributes and the extension is getting requestBadgeIdentifierForURL called. However, attempting to read the the extended attribute using getxattr() is blocked by the sandbox. I tried creating an app group and to store the folder urls as security scoped bookmarks in the group but this fails when trying to resolve the bookmark. In retrospect this makes sense since the security scoped bookmark is supposed to be used for accessing the same url by the same app in the same sandbox which is not the case when dealing with an un-sandboxed app and a sandboxed Finder Find Extension. I read somewhere (here: https://developer.apple.com/forums/thread/66259?page=2) from someone, quoting DTS on a similar issue that he can either communicate to the main app process to get the information or use document scoped security scoped bookmarks but I'm having trouble finding information about document scoped bookmarks and I'm not sure if it makes sense either. Thanks in advance Eyal
5
0
1.3k
Dec ’22
Restoring View controller hierarchy for scene state restoration before window is showing
I'm working on adding multiple window support to my app. My app is a document based app, with one view controller serving as the document browser (document selector) and a second view controller  for editing the document (document controller). The document selector is the root view controller. Normally, when the user taps a document icon in the selector, my app presents the document controler over the selector. When restoring the scene (when it has an open document)  I want to do the same (so to have the document selector underneath and on top of it show the document editor) but without showing the user document opening animations and so on. Problem is, if I try to do all the document opening before the window is showing I'm getting the follwoing error: [Presentation] Attempt to present <ERDocumentController: 0x7fd859020400> on <ERDocumentSelector: 0x7fd857c0cd60> (from <ERDocumentSelector: 0x7fd857c0cd60>) whose view is not in the window hierarchy. And if I do the document opening after showing the window, I see the animation (and even if I remove the animation, I still see the document selector for a little bit). Is there a way to setup this hierarchy before showing the window?
0
0
389
Oct ’20
Block stripping of com.apple.security.get-task-allow
Trying to profile my mac app with instruments. I am not able to start with "Allocations" or "Leaks", I'm asked for my admin password and then immediately seeing an error in the log: "Failed to attach to target: Failed to attach to target process." "Time Profiler" seems to work ok. Changed the build configuration for profiling to "Debug" in the scheme seemed to help and after some digging I found out this is happening because the debug build has com.apple.security.get-task-allow entitlement while the release build doesn't. Great, so I've added this entitlement to the entitlement file but still no go, checked the signature and saw that com.apple.security.get-task-allow was removed. Did some more digging and read somewhere that you need to set CODE SIGN INJECT BASE ENTITLEMENTS to NO. Did that but still no luck. Does anyone have any idea how to prevent Xcode from stripping this entitlement in the release build? I really want to profile my app using a release build.
4
0
1.9k
Jul ’20