ios - Xamarin IOS 文件选择器卡住

标签 ios xamarin cross-platform filepicker

我正在使用 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 Privacy Permissions Blog Post

关于ios - Xamarin IOS 文件选择器卡住,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55611601/

相关文章:

ios - 在 swift 2.0 中构建自定义相机应用程序时出错

c# - 如何在 ios 项目的 Xamarin.Forms 编辑器中添加显示/隐藏密码图像。 (滚动和 UI 放置问题)

c# - Xamarin.Forms 填充 ListView

android - 使用按钮添加动态小部件

ios - ios 13 之后的 future iOS 版本是否仍支持 Storyboard?

ios - Swift:从 AppDelegate 中的 UNTextInputNotificationAction 获取内容

ios - 页面在 Safari 中呈现,但在 iPad 上的 Chrome 中不呈现

c# - Xamarin.Auth AccountStore 不删除值?

git - 使用git备份配置文件

c++ - 如何在可移植代码中验证 Microsoft 可移植可执行格式的数字签名?