LockedCameraCapture - Access to App Group User Defaults in a lock screen camera extension

From what I understood from watching the session LockedCameraCapture, the extension doesn't have access to the App Group User Defaults, so I'm wondering how I can synchronize preferences between the extension and the main app.

From what I can see, the builtin iOS Camera app is able to synchronize its preferences. For example, the "Live Photo" mode toggle state is preserved whether in the main app or in the lock screen.

Is there anything I'm not aware of?

Answered by Frameworks Engineer in 790698022

Hello!

Yes, you understood correctly: the extension does not have access to App Group User Defaults.

We recommend using the AppContext to synchronize information between the app and extension. The AppContext is a type of your choice, up to a certain size, persisted across both.

The AppContext is accessible on the CameraCaptureIntent, check it out here: https://developer.apple.com/documentation/AppIntents/CameraCaptureIntent

Discussed in the documentation here: https://developer.apple.com/documentation/lockedcameracapture/creating-a-camera-experience-for-the-lock-screen#Launch-your-app-extension

There was also some material about AppContext in the session. Let us know if you have any questions about it! 😀

Accepted Answer

Hello!

Yes, you understood correctly: the extension does not have access to App Group User Defaults.

We recommend using the AppContext to synchronize information between the app and extension. The AppContext is a type of your choice, up to a certain size, persisted across both.

The AppContext is accessible on the CameraCaptureIntent, check it out here: https://developer.apple.com/documentation/AppIntents/CameraCaptureIntent

Discussed in the documentation here: https://developer.apple.com/documentation/lockedcameracapture/creating-a-camera-experience-for-the-lock-screen#Launch-your-app-extension

There was also some material about AppContext in the session. Let us know if you have any questions about it! 😀

Thank you for your response! The documentation is very helpful and also addresses other questions, such as the business model.

LockedCameraCapture - Access to App Group User Defaults in a lock screen camera extension
 
 
Q