Chapter 5 - entering the Mac Catalyst App

Hi All,

Following the steps in the book for enabling running the iOS app on the Mac, I got a long warning in the output window :

BullsEyePlus[2609:105114] [User Defaults] Couldn’t write values for keys (ApplicationAccessibilityEnabled) in CFPrefsPlistSource<0x600002c12e80> (Domain: com.apple.Accessibility, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: Yes): setting preferences outside an application’s container requires user-preference-write or file-write-data sandbox access
2019-11-07 07:03:50.302763+0100 BullsEyePlus[2609:105114] [User Defaults] Couldn’t write values for keys (FullKeyboardAccessFocusRingEnabled) in CFPrefsPlistSource<0x600002c12e80> (Domain: com.apple.Accessibility, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No): setting preferences outside an application’s container requires user-preference-write or file-write-data sandbox access
2019-11-07 07:03:50.304350+0100 BullsEyePlus[2609:105114] [User Defaults] Couldn’t write values for keys (ApplicationAccessibilityEnabled) in CFPrefsPlistSource<0x600002c12e80> (Domain: com.apple.Accessibility, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No): setting preferences outside an application’s container requires user-preference-write or file-write-data sandbox access
2019-11-07 07:03:59.995430+0100 BullsEyePlus[2609:105114] Metal API Validation Enabled

Then the app crashes trying to hit the button.
I understand there is a need for giving access rights to the directory for writing but did not success in understanding how to proceed.

Any proposal?

Thanks
LoulouFr64

hi! I get the same warnings but the app still works. Can you find anything in the console app under crash reports?

Hey, thanks for the information!

1 Like

In my app I am accessing the camera feature and application crashes with the same console error. Can you please suggest how to get rid of this crash?

Thanks.

hi Neil: if your app uses the camera, you have to test it on a real device — the simulator crashes.

If you are running it on a device, what’s the error?

Those errors are harmless, the issue would be unrelated. Some old code in AppKit is trying to write to a preference domain outside the sandbox without checking that the app is sandboxed first. Basically that code was written before the app sandbox existed. Apple should refactor this to remove the warning, but it can be ignored.

1 Like

This is not entirely true. While the errors really indicate something is writing settings to UserDefaults outside of app’s sandbox, but in my case, this also indicated that any settings I wrote into the same UserDefaults were not stored as well and the application would crash. In my case it was using a different suite to initialize UserDefaults.

thanks Dal! I’ll look into this when I update this chapter.