I've had to rewrite my app to get widgets working properly, and I've got this project structure:
-
Main iOS app:
- Bundle identifier = com.me.myapp
- Contains:
- Widget Extension:
- Bundle identifier = com.me.myapp.widgets
- Targets iOS 17
- Provides widgets to iOS
- Widget Extension:
-
Watch app:
- Bundle identifier = com.me.myapp.watchapp
- Contains:
- Complications Extension (a Widget Extension):
- Bundle identifier = com.me.myapp.watchapp.complications
- Targets watchOS 10
- Provides widgets to watchOS
- Complications Extension (a Widget Extension):
On the Signing & Capabilities tab in Xcode 15, all four targets have:
- Provisioning Profile: Xcode Managed Profile
- Signing Certificate: Apple Development: My team
- App Groups: all use the same one: group.com.me.myapp
I can build and deploy to a physical iPhone and Apple Watch, but the Watch app doesn't seem to be able to access the shared Core Data, which should be in the shared app group container.
When running the main iOS app, the store location is: file:///private/var/mobile/Containers/Shared/AppGroup/189E5907-E6E4-4790-833F-06944E4FF5FF/data-model/TheDataModel
When running the widget extension, the store location is: file:///private/var/mobile/Containers/Shared/AppGroup/189E5907-E6E4-4790-833F-06944E4FF5FF/data-model/TheDataModel
When I run the Watch app, the store location is different: file:///private/var/mobile/Containers/Shared/AppGroup/55381E6D-410E-4322-93BA-64BD1933909E/data-model/TheDataModel
How do I get the Watch app to see the Core Data store from the main app? Do I have to replicate the store to that location every time something changes in the main app? Or do I have to go back to sending massive data sets as dictionaries/data via WatchConnectivity?