Crash on iOS9 with -[NSPersistentStoreCoordinator _coordinator_you_never_successfully_opened_the_database_device_locked:]

后端 未结 2 461
有刺的猬
有刺的猬 2021-01-13 02:42

My app have recently been getting these crashes from crashlytics that is only happening on iOS9

Fatal Exception: NSInternalInconsistencyException

2条回答
  •  甜味超标
    2021-01-13 03:31

    Answer from the Apple dev forum here which also explains a possible cause and a solution.

    The cause is in the descriptor: Your application tried to open the open the persistent store while the device was locked, and your code tripped over the data protection API.

    That's the sort of thing that you trip over on new devices and new iOS versions because the new device is fast enough to get your app running before the data protection code is done with the transition.

    Solution to this kind of issue can be something like below

    You pretty much have to go into your start up code, and rewrite it so that it checks to see if protected data is available, and then delaying your Core Data start up until applicationProtectedDataDidBecomeAvailable.

提交回复
热议问题