So habe ich Core-Daten in den freigegebenen Container in meiner App verschoben. Ich mache das, wenn die App startet.
NSUserDefaults* sharedDefs = [GPMapCore sharedCore].sharedUserDefaults;
if (![sharedDefs boolForKey:@"CoreDataMovedToExtension"])
{
NSURL* oldLocation = GET_LOCATION_OF_CORE_DATA_SQLITE_FILE();
NSURL* newLocation = GET_LOCATON_TO_MOVE_THE_SQLITE_FILE_TO();
if ([[NSFileManager defaultManager] fileExistsAtPath:[oldLocation filePathString]])
{
//Check if a new file exists. This can happen when the watch app is run before
//Topo Maps+ runs and move the core data database
if ([[NSFileManager defaultManager] fileExistsAtPath:[newLocation filePathString]])
{
[[NSFileManager defaultManager ] removeItemAtURL:newLocation error:nil];
}
[[NSFileManager defaultManager] moveItemAtURL:oldLocation toURL:newLocation error:nil];
}
[sharedDefs setBool:YES forKey:@"CoreDataMovedToExtension"];
[sharedDefs synchronize];
}
Thaks wäre, ist diese Antwort vollständiger ... –