Guess I'm just in the habit of initializing things. :-) PersistentStoreCoordinator is non-nil. Store returns nil. Console just gives the infamous message: "Storage:persistentStoreCoordinator The operation couldn¹t be completed. (Cocoa error 1560.)"
On 2/8/11 2:51 PM, "Quincey Morris" <quinceymor...@earthlink.net> wrote: > On Feb 8, 2011, at 12:08, Gordon Apple wrote: > >> persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] >> initWithManagedObjectModel: self.managedObjectModel]; >> >> NSError *error = nil; >> NSPersistentStore* store = >> [persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType >> configuration:nil >> URL:storeUrl >> options:options >> error:&error]; >> if(store != nil) >> return persistentStoreCoordinator; // Normal exit. >> >> // Error handling... >> return nil; >> } > > It seems to me there's only two ways this code can return nil -- one is if > 'initWithManagedObjectModel:' returns nil (which you don't check for, but will > result in store being nil down the line), and the other is if > 'addPersistentStoreWithType:...' detects an error. > > So you first need to know which of the two actually happens. If adding the > persistent store returns an error, what is the error? > > Also, did you check the log for any error messages? > >> I am confused about some things going on behind-the scenes. The project >> folder contains only the xcdatamodeld file (the compiled version), not the >> original xcdatamodel shown in the project listing. Also, for the main >> entity, somewhere along the way, the project folder has picked up a folder >> labled "Model-1.moved-aside", which does not show up in the project window. >> Is this something needed in the migration? I'm about at my wit's end with >> this thing. > > This doesn't seem wrong, necessarily. 'xcdatamodeld' is the extension for a > *package* folder that contains the 'xcdatamodel' files when you have multiple > model versions -- as you now do. The 'moved-aside' item sounds like a > consequence of the problems you reported earlier in getting a copy of your > project to refer to the correct model files -- I wouldn't necessarily worry > any further about it. > > > P.S. It's OT, but initializing 'error' to nil before passing it to an > error-returning method is both a waste of time and semantically incorrect -- > it's an *output only* parameter to the method. OTOH, setting it to nil isn't > inherently harmful. :) > _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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 arch...@mail-archive.com