首页 > 解决方案 > programmatically set file visibility on iOS (LSSupportsOpeningDocumentsInPlace)

问题描述

I would like to control at runtime whether or not my app's files should be visible to users in the Files app (based upon some app-internal permissions logic).

As far as I'm aware, this functionality can be set in an app's read-only Info.plist at design-time via the following two keys, and is shipped as part of the app bundle:

I've tried setting these values as false ("YES") in the Info.plist, and then overriding them at runtime with:

NSUserDefaults.StandardUserDefaults.SetBool(
    true,
    "UIFileSharingEnabled");
NSUserDefaults.StandardUserDefaults.SetBool(
    true, 
    "LSSupportsOpeningDocumentsInPlace");

The values are updated correctly in NSUserDefaults, but it doesn't have any effect on whether or not the app's files are visible in the Files app.

Although I'm on Xamarin I'd still welcome swift/objectiveC answers.

标签: iosxamarinsettings

解决方案


推荐阅读