苹果拒绝了我的应用,并提供了崩溃日志,表明他们已在装有iOS 8.0.2的iPhone 6上对其进行了测试。我使用相同的iPhone 6和8.0.2测试了我的应用程序,它运行完美。我通过iTunesConnect在testflight上进行了尝试,假设这与Apple进行的测试完全相同-显然不是!
是否有人有想法,我如何解决该问题(已经与审核小组联系,但是他们无济于事,因为他们说他们不是技术支持,只是测试应用程序。
我遇到的问题是(从我的角度来看还是很奇怪):添加持久性存储时崩溃:
NSError *error = nil;
_persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]];
if (![_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:nil error:&error]) {
/*
Replace this implementation with code to handle the error appropriately. abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
Typical reasons for an error here include:
* The persistent store is not accessible;
* The schema for the persistent store is incompatible with current managed object model.
Check the error message to determine what the actual problem was.
If the persistent store is not accessible, there is typically something wrong with the file path. Often, a file URL is pointing into the application's resources directory instead of a writeable directory.
If you encounter schema incompatibility errors during development, you can reduce their frequency by:
* Simply deleting the existing store:
[[NSFileManager defaultManager] removeItemAtURL:storeURL error:nil]
* Performing automatic lightweight migration by passing the following dictionary as the options parameter:
@{NSMigratePersistentStoresAutomaticallyOption:@YES, NSInferMappingModelAutomaticallyOption:@YES}
Lightweight migration will only work for a limited set of schema changes; consult "Core Data Model Versioning and Data Migration Programming Guide" for details.
*/
NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
abort();
}
它显然崩溃是因为我abort()
仍然有该语句,但是我不确定该怎么做(即要解决该问题-只是删除并尝试再次添加存储?)
因为它在我的iPhone上可以正常使用,所以我认为这不是源代码中列出的问题之一(例如目录,模型等。对吗?)我正在努力工作几天,有任何帮助或想法非常感谢!!
发生这种情况的常见原因是storeURL上已经有一个文件,并且该文件不符合您指定的模型。
为此,您可以执行以下操作:1)启用轻量级迁移2)删除现有文件,然后重试
NSDictionary *options = @{NSMigratePersistentStoresAutomaticallyOption: @YES,
NSInferMappingModelAutomaticallyOption: @YES
};
BOOL successOfAdding = [_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType
configuration:nil
URL:storeURL
options:options
error:&error] != nil;
if (successOfAdding == NO)
{
// Check if the database is there.
// If it is there, it most likely means that model has changed significantly.
if ([[NSFileManager defaultManager] fileExistsAtPath:storeURL.path])
{
// Delete the database
[[NSFileManager defaultManager] removeItemAtURL:storeURL error:nil];
// Trying to add a database to the coordinator again
successOfAdding = [_persistentStoreCoordinator addPersistentStoreWithType: NSSQLiteStoreType configuration:nil URL:storeURL options:nil error:&error] != nil;
if (successOfAdding == NO)
{
NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
abort();
}
}
关于拒绝-您是否有以前版本的应用程序?另外,您要在哪里存储数据库?可能无法访问该路径?
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句