【发布时间】:2019-04-01 15:05:11
【问题描述】:
我正在尝试在 Xcode 上开发一个使用核心数据的应用程序,但是,当我提交该应用程序进行测试审查时,它会在他们的模拟器上崩溃,但不是我的。这是怎么回事?
对于初学者,我最近完成了一个需要一段时间开发的应用程序,然后将其提交到 iTunes Connect。我的应用程序被拒绝,因为“我们无法审查您的应用程序,因为它在启动时崩溃了”。我收到并标出了崩溃发生的路线。
崩溃发生在我的 App Delegate 的第 81 行,正是我去哪里获取持久性容器并加载它。
lazy var persistentContainer: NSPersistentContainer = {
/*
The persistent container for the application. This implementation
creates and returns a container, having loaded the store for the
application to it. This property is optional since there are legitimate
error conditions that could cause the creation of the store to fail.
*/
let container = NSPersistentContainer(name: "AlarmSavedData")
container.loadPersistentStores(completionHandler: { (storeDescription, error) in
if let error = error as NSError? {
print("Here!")
// Replace this implementation with code to handle the error appropriately.
// fatalError() 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 parent directory does not exist, cannot be created, or disallows writing.
* The persistent store is not accessible, due to permissions or data protection when the device is locked.
* The device is out of space.
* The store could not be migrated to the current model version.
Check the error message to determine what the actual problem was.
*/
fatalError("Unresolved error \(error), \(error.userInfo)")
}
})
return container
}()
我希望本地数据库能够很好地为他们加载,但由于某种原因,我是唯一加载数据库的人。我可以使用它,但是当 Apple Review 团队尝试运行它时,它崩溃了。关于正在发生的事情以及如何解决它的任何想法?目标是让每个用户都拥有自己的本地数据库,使用核心数据来存储他们创建的数据。
【问题讨论】:
-
您发布的两个 imgur 链接都是您发布的相同代码的屏幕截图。我认为这是一个错误——你想发布部分崩溃报告,这会很有帮助。
-
您应该查看从 App Review 收到的崩溃报告中的硬件型号和 iOS 版本,并测试您的应用模拟两者。
-
我在底部添加了崩溃日志。 iOS版本是12.1.4,但我不知道硬件版本在哪里。我只复制了崩溃日志的上半部分和它崩溃的线程。如果您需要更多崩溃报告,请告诉我。
标签: swift core-data app-store-connect