core data - Using same iCloud enabled CoreData store across Watch Extension and iPhone -


i'm witnessing strange behaviour when opening icloud enabled coredata store apple watch extension. i'm using same icloud container across targets.

here picture shows folder (ubiquity container) structure looks inside ubiquity container :

different stores apple watch & iphone

it looks creates different stores iphone & watch

i'm sharing same coredata stack between iphone app & watch extension. ideas why happening ? if understand correctly treats iphone app & watch extension separate users ?

i appreciate if give advice.

you should use app groups share same core data store between watch , iphone. enable app groups both targets, configure in provisioning profiles , persistent store url this:

nsurl *storeurl = [[nsfilemanager defaultmanager]       containerurlforsecurityapplicationgroupidentifier:appgroupidentifier]; 

the watch accessing core data store via watchkit extension enabled app groups. see e.g. figure 4.1 in apple's app extension programming guide.

enter image description here


Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -