lundi 28 mars 2016

Hosting Core Data IAP Content with Apple

My initial in-app purchases were included in the Main Bundle, formatted as Core Data/Sqlite files. Now I want Apple to host all further IAPs. So far I’ve done the setup in iTunes connect, successfully downloaded the files and moved them from the cache to the Application Support Directory.:

    if ([fileManager moveItemAtPath:fullPathSrc toPath:fullPathDst error:&error] == NO) {
        NSLog(@"Error: unable to move item: %@", error);
    }

At this point the source path is: /private/var/mobile/Containers/Data/Application/54EBE737-AB3C-414D-ABE6-C472469431EF/Library/Caches/http://ift.tt/1MOS1vQ

and the destination path is: /var/mobile/Containers/Data/Application/54EBE737-AB3C-414D-ABE6-C472469431EF/Library/Application Support/Downloads/Packet5.sqlite

Looking good until my Core Data class tries to access a sqlite file, as follows:

NSURL *modelURL = [NSURL fileURLWithPath:(NSString *)packetLocator[currPacketNum]]; // packetLocator[currPacketNum] contains the destination path above.

Then I get the following error message: CoreData: Failed to load keyed archive model at path '/var/mobile/Containers/Data/Application/54EBE737-AB3C-414D-ABE6-C472469431EF/Library/Application Support/Downloads/Packet5.sqlite'

Perhaps there's a global problem; i.e., Is it even possible to host Core Data with Apple? Has anyone successfully hosted Core Data, or know of a workaround to this problem?

Aucun commentaire:

Enregistrer un commentaire