It's happening because you removed the iCloud entitlement. Without that, you're not permitted to access the iCloud store, so the whole scheme falls apart. If this works on iOS 6, it's a bug, because you're really not supposed to get access to anything iCloud-related without the correct entitlements. With iOS 7 there are a ton of internal changes, so it's not surprising they found and fixed that.
So you'll need to put that entitlement back.
Two other details:
- When you do the migration, make sure to set the new
NSPersistentStoreRemoveUbiquitousMetadataOption
to@YES
in theoptions
dictionary. Otherwise some cloud-related metadata will stick around, and that can really ruin your day later on. (You might already know this but since you didn't mention it I thought I would). - When you remove the cloud store, don't use that
NSFileManager
call. For one thing, it misses the SQLitewal
andshm
files. Worse than that though, it leaves all the existing iCloud transaction logs just sitting there taking up space. You'll want the new(ish)removeUbiquitousContentAndPersistentStoreAtURL:options:error
method onNSPersistentStore
. Theoptions
dictionary here should include the same cloud-related keys you'd use when adding an iCloud store, because that's necessary to find the transaction logs.