iOS8 crash when try to use UIDocumentMenuViewContr

2019-09-16 13:09发布

问题:

I use Xamarin.Forms to create iOS app and I use UIDocumentMenuViewController to Access iCloud file.

When I run program on iOS9+ program is run normally, But when I try my program with iOS8 emulator program is crash on

new UIDocumentMenuViewController(allowedUTIs, UIDocumentPickerMode.Import);

and message is saying

'Application initializing document picker is missing the iCloud entitlement. Is com.apple.developer.icloud-container-identifiers set?'

What wrong with my app and how can I fix this?

Thank you in advance.

回答1:

You need to make sure that you have enabled the iCloud Entitlements as described here.

This is even mentioned in the official iOS documentation:

Before your app can use the document picker, you must turn on the iCloud Documents capabilities

If you haven't done so already, simply create a new Entitlements.plist file in the root of your project. Then simply enable the iCloud option.



回答2:

Check that you have linked Entitlements.plist to your project...

I dont know why, but by default Entitlements.plist is not linked, you can do the same by going to option of project and assign custom Entitlement like this!