Hi Marc, In fact I am doing that. He's the options dictionary for the persistent store creation.
NSMutableDictionary *dict = [NSMutableDictionary dictionary]; [dict setObject:[NSNumber numberWithBool:YES] forKey:NSMigratePersistentStoresAutomaticallyOption]; [dict setObject:@"<app_name>.store" forKey:NSPersistentStoreUbiquitousContentNameKey]; NSURL *contentURL = [[NSFileManager defaultManager] URLForUbiquityContainerIdentifier:@"<TeamID>.<bundle_identifier>"]; [dict setObject:contentURL forKey:NSPersistentStoreUbiquitousContentURLKey]; (obviously with the <>'s filled in appropriately.) Note, if I pass the bundle identifier to URLForUbiquityContainerIdentifier: as the WWDC video suggests, then I get nil for the contentURL. So in other words, NSString *bundleId = [[NSApp mainBundle] bundleIdentifier]; NSURL *contentURL = [[NSFileManager defaultManager] URLForUbiquityContainerIdentifier:bundleId]; then contentURL is nil. Perhaps this gives a clue what I've got configured wrongly? Any other clues you can pass my way would be gratefully received, Martin On 17, Oct, 2011, at 04:33 AM, Marc Respass wrote: >> Has anyone come across a sample app which demonstrates how to make a shoebox >> core data app which works with iCloud? I've dug into the documentation but I >> can't find any sample code. The "What's new in Core Data on Mac OS X" >> session from WWDC 2011 hints at some things but doesn't show any sample >> code. I think I've managed to get the app to register with iCloud by >> fighting with the provisioning profile stuff, but I don't see the app >> appearing in the iCloud preferences list of app (maybe it isn't supposed >> to?) but when I click on "Manage" then I see an app which has appeared but >> it's called "Unknown" and it has a fraction of the amount of data I'd >> expect. Then I tried the app on another machine and I get some notifications >> of type NSPersistentStoreDidImportUbiquitousContentChangesNotification >> together with lots of console messages starting with >> "_PFUbiquityRecordImportOperation >> processObjects:withState:withGlobalIDIndexesToLocalURIMap:andImportContext:outError" >> which seem to indicate some action has taken place. Now I'm stuck with what >> to do with these notifications. The WWDC sessions says one should use >> methods of the NSFilePresenter protocol, but I'm unsure how to go about >> this. Some sample code for the app shown in the WWDC session sure would help. > > Hi Martin, > > It sound like you did not include NSPersistentStoreUbiquitousContentNameKey > as part of the options dictionary when creating your persistent store > coordinator > > NSDictionary *options = [NSDictionary > dictionaryWithObjectsAndKeys:uuid_string, > NSPersistentStoreUbiquitousContentNameKey, nil]; > [persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType > configuration:nil > URL:storeUrl > options:nil > error:&error]) > > It's tricky to figure out exactly what to do. I found this Using Core Data > with iCloud Release Notes under "Guidance for Library-style Applications". > > Hope this helps > Marc_______________________________________________ > > Cocoa-dev mailing list ([email protected]) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/martin.hewitson%40aei.mpg.de > > This email sent to [email protected] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Martin Hewitson Albert-Einstein-Institut Max-Planck-Institut fuer Gravitationsphysik und Universitaet Hannover Callinstr. 38, 30167 Hannover, Germany Tel: +49-511-762-17121, Fax: +49-511-762-5861 E-Mail: [email protected] WWW: http://www.aei.mpg.de/~hewitson ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Martin Hewitson Albert-Einstein-Institut Max-Planck-Institut fuer Gravitationsphysik und Universitaet Hannover Callinstr. 38, 30167 Hannover, Germany Tel: +49-511-762-17121, Fax: +49-511-762-5861 E-Mail: [email protected] WWW: http://www.aei.mpg.de/~hewitson ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ _______________________________________________ Cocoa-dev mailing list ([email protected]) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
