Hi all,
I am creating an app that includes a sandboxed FinderSync extension and an unsandboxed main app. The app runs fine when running it from xcode and also on any Mac that has ever run it from XCode but whenever I put the app on a clean Mac that has not run the app in XCode it crashes seconds after I trigger a function in my finder sync extension.
I think that the error occurs around here
FindeSync.swift
func showWindow(with context: NSExtensionContext) {
NSLog("hello")
let center: DistributedNotificationCenter = DistributedNotificationCenter.default()
print("1")
let notificationName = NSNotification.Name("com.jdoglobal.JDOShare.displayWindow")
print("2")
center.postNotificationName(notificationName, object: nil, deliverImmediately: true)
print("3")
}
as "hello" is printed to the console but "1", "2", or "3" are never printed
but the notification is received as you can see the window pop up briefly before crashing.
AppDelegate.Swift
func applicationDidFinishLaunching(_ aNotification: Notification) {
DistributedNotificationCenter.default().addObserver(self,
selector: #selector(displayWindow),
name:
Notification.Name("com.jdoglobal.JDOShare.displayWindow"),
object: nil)
Here is my crash report from the clean Mac:
Here is all console logs for lifespan of the app.
default 15:51:55.753371+0100 JDO-Share Received configuration update from daemon (initial)
default 15:51:55.754173+0100 JDO-Share CHECKIN: pid=2053
default 15:51:55.762979+0100 JDO-Share CHECKEDIN: pid=2053 asn=0x0-0x10d10d foreground=0
default 15:51:55.764550+0100 JDO-Share FRONTLOGGING: version 1
default 15:51:55.764568+0100 JDO-Share Registered, pid=2053 ASN=0x0,0x10d10d
default 15:51:55.766695+0100 JDO-Share BringForward: pid=2053 asn=0x0-0x10d10d bringForward=0 foreground=0 uiElement=1 launchedByLS=1 modifiersCount=1 allDisabled=0
default 15:51:55.766968+0100 JDO-Share BringFrontModifier: pid=2053 asn=0x0-0x10d10d Modifier 0 hideAfter=0 hideOthers=0 dontMakeFrontmost=0 mouseDown=0/0 seed=0/0
default 15:51:55.767899+0100 JDO-Share Current system appearance, (HLTB: 2), (SLS: 1)
default 15:51:55.769399+0100 JDO-Share No persisted cache on this platform.
default 15:51:55.771110+0100 JDO-Share Post-registration system appearance: (HLTB: 2)
default 15:51:55.806716+0100 JDO-Share Registering for test daemon availability notify post.
default 15:51:55.806859+0100 JDO-Share notify_get_state check indicated test daemon not ready.
default 15:51:55.806950+0100 JDO-Share notify_get_state check indicated test daemon not ready.
default 15:51:55.807043+0100 JDO-Share notify_get_state check indicated test daemon not ready.
default 15:51:55.810609+0100 JDO-Share SignalReady: pid=2053 asn=0x0-0x10d10d
default 15:51:55.811420+0100 JDO-Share SIGNAL: pid=2053 asn=0x0x-0x10d10d
error 15:51:55.826136+0100 JDO-Share Couldnt read values in CFPrefsPlistSource<0x600003636780> (Domain: group.XXXXXX.com.jdoglobal.JDOShare, User: kCFPreferencesAnyUser, ByHost: Yes, Container: (null), Contents Need Refresh: Yes): Using kCFPreferencesAnyUser with a container is only allowed for System Containers, detaching from cfprefsd
default 15:52:06.743503+0100 JDO-Share LSExceptions shared instance invalidated for timeout.
default 15:52:33.533476+0100 RightClick hello
default 15:52:33.551801+0100 JDO-Share NSApp cache appearance:
-NSRequiresAquaSystemAppearance: 0
-appearance: (null)
-effectiveAppearance: <NSCompositeAppearance: 0x600003604a80
(
"<NSDarkAquaAppearance: 0x60000361c680>",
"<NSSystemAppearance: 0x60000361a880>"
)>
error 15:52:33.578002+0100 JDO-Share cannot open file at line 45530 of [9ff244ce07]
error 15:52:33.578033+0100 JDO-Share os_unix.c:45530: (2) open(/var/db/DetachedSignatures) - No such file or directory
default 15:52:33.583056+0100 JDO-Share TrustSettingsUseXPC is enabled (via feature flags)
default 15:52:33.586821+0100 JDO-Share SetFrontProcess: asn=0x0-0x10d10d options=1
default 15:52:33.840691+0100 JDO-Share Not internal release, disabling SIRL
default 15:52:33.840879+0100 JDO-Share Adding securityd connection to pool, total now 1
default 15:52:33.848897+0100 JDO-Share -[SOConfigurationClient init] on <private>
default 15:52:33.849334+0100 JDO-Share <SOServiceConnection: 0x600001853280>: new XPC connection
I am getting really confused as to why the app works completely fine on my Mac and not on a clean Mac so if anyone could shed any light on this it would be great.
For extra context:
-
The app leads on to use Microsoft's MSAL library which I am unsure if this is having any affect on it.
-
I have double checked the app groups in the developer portal and on each target in the app.
-
The app works across both intel and M1 if being run/ has been run from xcode. and crashes across multiple versions of Ventura and Monterey and chips if not been run.
-
I Get the "Distributed" app by Archiving > Distribute App > Developer ID > Export > Automatically Manage Signing > Then save. I have tried a few different variations of this but I've found this the best way as I'm not releasing on the App store
-
Again it works perfectly fine on my Mac after I have made sure I have shut down any debugging processes happening and it is purely the distributed app running.
As a side note I have followed loads of tutorials on how to set up shared defaults between an app and it's extension and it seems to work but I can't get rid of this error.
error 15:51:55.826136+0100 JDO-Share Couldnt read values in CFPrefsPlistSource<0x600003636780> (Domain: group.XXXXXX.com.jdoglobal.JDOShare, User: kCFPreferencesAnyUser, ByHost: Yes, Container: (null), Contents Need Refresh: Yes): Using kCFPreferencesAnyUser with a container is only allowed for System Containers, detaching from cfprefsd
Is it worth worrying about or can I just leave it?
Any help/ code improvements are greatly appreciated thanks :)
Consider this snippet from your crash report:
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Your app crashed because it hit a trap, probably from the Swift runtime.
Now look at the crashing thread’s backtrace:
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 JDO-Share … 0x100548000 + 48204
1 JDO-Share … 0x100548000 + 47964
2 JDO-Share … 0x100548000 + 34396
3 JDO-Share … 0x100548000 + 34776
4 libdispatch.dylib … _dispatch_call_block_and_release + 32
Frame 4 shows that this is some sort of block being run on a queue by Dispatch. Frames 3 through 0 are your code. These are not symbolicated, so it’s hard to say what’s going on. I recommend that you symbolicate your crash report to uncover the identity of this code. See Adding Identifiable Symbol Names to a Crash Report.
Also, just as an aside, you wrote:
as "hello" is printed to the console but "1", "2", or "3" are never printed
While I’m all on board with ‘printf debugging’, actually using print(…)
for that is less than ideal. Instead I recommend the system log. For all the details, see Your Friend the System Log.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"