iCloud UIDocumentPicker crashes intermittently and hangs

寵の児 提交于 2019-11-30 12:38:41

I recently stumpled opon the same problem:

*** Assertion failure in -[UIDocumentPickerViewController _commonInitWithCompletion:]

is caused due to lacking App-Capabilities. Go to your Build and choose Capabilities -> iCloud

Activate it via the switch on the right hand side and toggle iCloud Documents and CloudKit ON. (Notice: This will only work with a payed developer account)

Rebuild->Run

Also have in mind:

iCloud entitlements are available only to apps submitted to the App Store or to the Mac App Store. (Source)

Seems the following error is occurring for iCloud entitlement is not being set correctly. Please check it again. Your containing app and extensions needs to be in same App groups. Enable App groups from Capabilities if it is not enabled. If both are are set correctly and still you get the error then have no clue from where it might happen.

2015-03-18 16:22:15.960 E-Sign[6338:1860982] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Application initializing document picker is missing the iCloud entitlement. Is com.apple.developer.icloud-container-identifiers set?'

I am also facing other errors. That is why I am here.

After researching a lot I came to an important conclusion :

I was dealing with same kind of issue and it was really hurting. So after checking the code deep and debugging the ultimate result for this is to manage the UI changes which you are performing while displaying the Picker. The transition of displaying the picker and the UI changes generates the irritate behaviour and ultimately crashes and hangs.

So my suggestion would be minimize the UI updation and make those changes in background so that the opening of picker is seamless.

My issue was solved after making those changes.

When calling the method, make sure you call it in background thread. It will fix the problem.

dispatch_async(dispatch_get_global_queuue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0),^{ // CALL YOUR METHOD });

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!