我正在使用 xamarin.plugin.filepicker
它在安卓上运行良好。但对于 IOS(iPhone 6+),它不起作用。
一旦到达此代码:
var file = await CrossFilePicker.Current.PickFile();
它卡住了,无法继续,应用程序没有释放,它工作正常,但没有从“await CrossFilePicker.Current.PickFile();”中得到任何结果。
即使我单击“取消”或选择一个文件,也不会让代码在此行之后运行:
var file = await CrossFilePicker.Current.PickFile();
没有错误,什么都没有。
我正在使用该插件的最后一个稳定版本,然后我还尝试了“2.1.14-beta”。
问题是:为什么代码不执行“if (file != null)”语句?
var file = await CrossFilePicker.Current.PickFile(); << Stop here
if (file != null) << Not come here ever
提前致谢
最佳答案
我无法写评论...您是否已在 Info.plist 中设置 IOS 上的权限以访问库?
<key>NSCameraUsageDescription</key>
<string>This app needs access to the camera to take photos.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>This app needs access to photos.</string>
<key>NSMicrophoneUsageDescription</key>
<string>This app needs access to microphone.</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>This app needs access to the photo gallery.</string>
关于ios - Xamarin IOS 文件选择器卡住,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55611601/