Core data 我是否应该担心sandboxd拒绝文件写入数据';
我有一个数据库应用程序。单一实体。我刚刚升级它以启用iCloud同步。以下是我的应用程序代理中的PSC:Core data 我是否应该担心sandboxd拒绝文件写入数据';,core-data,icloud-api,Core Data,Icloud Api,我有一个数据库应用程序。单一实体。我刚刚升级它以启用iCloud同步。以下是我的应用程序代理中的PSC: - (NSPersistentStoreCoordinator *)persistentStoreCoordinator { if (persistentStoreCoordinator__ != nil) { return persistentStoreCoordinator__; } NSString *storePath = [[self applicationDocument
- (NSPersistentStoreCoordinator *)persistentStoreCoordinator
{
if (persistentStoreCoordinator__ != nil)
{
return persistentStoreCoordinator__;
}
NSString *storePath = [[self applicationDocumentsDirectory] stringByAppendingPathComponent: @"Logbook.sqlite"];
NSURL *storeURL = [NSURL fileURLWithPath:storePath];
persistentStoreCoordinator__ = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]];
NSPersistentStoreCoordinator* psc = persistentStoreCoordinator__;
if (IOS_VERSION_GREATER_THAN_OR_EQUAL_TO(@"5.0")) {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSFileManager *fileManager = [NSFileManager defaultManager];
NSLog(@"We're iniOS 5!");
// Migrate datamodel
NSDictionary *options = nil;
// this needs to match the entitlements and provisioning profile
NSURL *cloudURL = [fileManager URLForUbiquityContainerIdentifier:@"XXXXXXXXXX.com.burgul.Logbook"];
NSString* coreDataCloudContent = [[cloudURL path] stringByAppendingPathComponent:@"data"];
if ([coreDataCloudContent length] != 0) {
// iCloud is available
NSLog(@"...and iCloud is live!");
cloudURL = [NSURL fileURLWithPath:coreDataCloudContent];
options = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption,
[NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption,
@"Logbook.store", NSPersistentStoreUbiquitousContentNameKey,
cloudURL, NSPersistentStoreUbiquitousContentURLKey,
nil];
} else {
// iCloud is not available
NSLog(@"...but iCloud unavailable!");
options = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption,
[NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption,
nil];
}
NSError *error = nil;
[psc lock];
if (![psc addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:options error:&error])
{
NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
abort();
}
[psc unlock];
dispatch_async(dispatch_get_main_queue(), ^{
NSLog(@"asynchronously added persistent store!");
[[NSNotificationCenter defaultCenter] postNotificationName:@"RefetchAllDatabaseData" object:self userInfo:nil];
});
});
} else {
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption,
[NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption,
nil];
NSError *error = nil;
if (![psc addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:options error:&error])
{
NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
abort();
}
}
return persistentStoreCoordinator__;
}
我经常会遇到这个错误,但iCloud sync似乎在iPhone和iPad之间工作。我应该担心吗?为什么会发生这种情况
Feb 28 22:23:40 unknown Logbook[2191] <Warning>: We're iniOS 5!
Feb 28 22:23:41 unknown Logbook[2191] <Warning>: Root view loading...
Feb 28 22:23:41 unknown Logbook[2191] <Warning>: ...and iCloud is live!
Feb 28 22:23:41 unknown sandboxd[2192] <Notice>: Logbook(2191) deny file-write-data /private/var/mobile/Library/Mobile Documents/XXXXXXXXXX~com~burgul~Logbook
Feb 28 22:23:42 unknown Logbook[2191] <Warning>: -[PFUbiquityTransactionLog loadComparisonMetadataWithError:](220): CoreData: Ubiquity: Error encountered while trying to load the comparison metadata for transaction log: <PFUbiquityTransactionLog: 0x1fc020>
transactionLogLocation: <PFUbiquityLocation: 0x1fb3a0>: /private/var/mobile/Library/Mobile Documents/XXXXXXXXXX~com~burgul~Logbook/data/mobile.7B7D20A-AD93-5631-9E0D-61B5E5AE1DB0/Logbook.store/1DGRB5~3_aHWVwlP9v9teBUHYhFYHcmj6kWm8HjF~8=/5837F007-B39E-42C2-A3D1-F69998C2F251.1.cdt
transactionNumber: (null)
Error: Error Domain=NSCocoaErrorDomain Code=134301 "The operation couldn’t be completed. (Cocoa error 134301.)" UserInfo=0x172880 {reason=Error during property list parsing during import or opening of log file at location: <PFUbiquityLocation: 0x1fb7d0>: /private/var/mobile/Library/Mobile Documents/XXXXXXXXXX~com~burgul~Logbook/data/mobile.7B7D20A-AD93-5631-9E0D-61B5E5E1DB0/tempLogs.nosync/Logbook.store/1DGRB5~3_aHWVwlP9vteBUHYhFYUHmj6kWm8HjF~8=/5837F007-B39E-42C2-A3D1-F6998C2F251.1.cdt, error: Error Domain=NSCocoaErrorDomain Code=134301 "The operation couldn’t be completed. (Cocoa error 134301.)" UserInfo=0x185e80 {missingFile=/private/var/mobile/Library/Mobile Documents/XXXXXXXXXX~com~burgul~Logbook/data/mobile.7B7D20A-AD93-5631-9E0D-61B5E5AE1DB0/tempLogs.nosync/Logbook.store/1DGRB5~3_aHWVwlP9v9teBUHYhFYUHmj6kWm8HjF~8=/5837F07-B39E-42C2-A3D1-F69998C2F251.1.cdt}}
Feb 28 22:23:42 unknown Logbook[2191] <Warning>: -[PFUbiquityTransactionLog loadComparisonMetadataWithError:](220): CoreData: Ubiquity: Error encountered while trying to load the comparison metadata for transaction log: <PFUbiquityTransactionLog: 0x171780>
2月28日22:23:40未知日志[2191]:我们是iniOS 5!
未知日志[2191]:根视图加载。。。
2月28日22:23:41未知日志[2191]:…iCloud正在运行!
2月28日22:23:41未知沙盒[2192]:日志(2191)拒绝文件写入数据/private/var/mobile/Library/mobile Documents/xxxxxxxxx~com~burgul~Logbook
2月28日22:23:42未知日志[2191]:-[PFUbiquityTransactionLog loadComparisonMetadataWithError:(220):CoreData:Ubiquity:尝试加载事务日志的比较元数据时遇到错误:
交易日志位置::/private/var/mobile/Library/mobile Documents/xxxxxxxxx~com~burgul~Logbook/data/mobile.7B7D20A-AD93-5631-9E0D-61b5ae1db0/Logbook.store/1DGRB5~3_aHWVwlP9v9teBUHYhFYHcmj6kWm8HjF~8=/5837F007-B39E-42C2-A3D1-F69998C2F251.1.cdt
transactionNumber:(空)
错误:Error Domain=NSCOCAERRORDOMAIN Code=134301“操作无法完成。(Cocoa错误134301)。”UserInfo=0x172880{原因=在以下位置导入或打开日志文件时解析属性列表时出错::/private/var/mobile/Library/mobile Documents/xxxxxxxxx~com~burgul~Logbook/data/mobile.7B7D20A-AD93-5631-9E0D-61B5E5E1DB0/tempLogs.nosync/Logbook.store/1DGRB5~3_ahwwwwwwwwwwwlp9mjebuhyfyh6kwm8hjf~8=/5837F007-B39E-42C2-A3D1-f1d1,错误:Domain=NSCOCAERRORDOMAIN Code=134301“操作无法完成。(可可错误134301)。”UserInfo=0x185e80{missingFile=/private/var/mobile/Library/mobile Documents/xxxxxxxxx~com~burgul~Logbook/data/mobile.7B7D20A-AD93-5631-9E0D-61b5ae1db0/tempLogs.nosync/Logbook.store/1DGRB5~3_ahwvwlp9v9tebuhyhfyhjj6kwm8hjf~8=/5837F07-B39E-42C2-A3D1-F69998C2F251.1.cdt}}}
2月28日22:23:42未知日志[2191]:-[PFUbiquityTransactionLog loadComparisonMetadataWithError:(220):CoreData:Ubiquity:尝试加载事务日志的比较元数据时遇到错误:
你看到这篇文章了吗?你的问题似乎很相似。@Axel的解释似乎是正确的
尽管有上述错误,我还是将我的应用程序提交到了应用商店。它被接受并已上线2周。所有的工作似乎都很好,没有负面反馈。所以我决定冷静下来,忘掉它!是的。我也读了这篇文章。我认为你可能是对的,我应该忽略它。我只是认为“拒绝文件写入数据”暗示了某种权限问题。