繁体   English   中英

iOS 9.3 中的 FilePicker 异常

[英]FilePicker in iOS 9.3 Exception

尝试在 iOS 9.3 上运行的设备上实现文件选择器

这些功能在 Entitlements.plist 中打勾,代码适用于运行 iOS 12.2 的模拟设备。 还尝试模拟其他运行 iOS 9.3 的设备,结果是一样的

using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Plugin.FilePicker;
using System.Diagnostics;

namespace CrossfileTest
{

    [DesignTimeVisible(false)]
    public partial class MainPage : ContentPage
    {
        public MainPage()
        {
            InitializeComponent();
        }

        private async void BrowseBtn_Clicked(object sender, EventArgs e)
        {
            try
            {
                var file = await CrossFilePicker.Current.PickFile();
                Debug.WriteLine("this file " + file.FileName);
            }
            catch(Exception ex)
            {
                Debug.WriteLine("it blew up! " + ex);
            }
        }
    }
}```

This is the exception I get on iOS 9.3:
  at CrossfileTest.MainPage.BrowseBtn_Clicked (System.Object sender, System.EventArgs e) [0x00029] in C:\Users\UserName\source\repos\CrossfileTest\CrossfileTest\CrossfileTest\MainPage.xaml.cs:27  0   CoreFoundation                      0x000000010bba4d85 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x000000010c520deb objc_exception_throw + 48
    2   CoreFoundation                      0x000000010bba4bea +[NSException raise:format:arguments:] + 106
    3   Foundation                          0x000000010a7fcd5a -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 198
    4   UIKit                               0x00000001093485c5 -[UIDocumentPickerViewController _commonInitWithCompletion:] + 370
    5   UIKit                               0x000000010934a442 -[UIDocumentPickerViewController initWithDocumentTypes:inMode:] + 411
    6   CrossfileTest.iOS                   0x0000000102c25539 xamarin_dyn_objc_msgSend + 217
    7   ???                                 0x000000011f6039ee 0x0 + 4821367278

Ideas on how to fix this?

这显然是插件内部的崩溃。 您可以将问题发布在他们的 github 上以便修复。

UIDocumentPickerViewController在 iOS 9 和 iOS 12 上的工作方式有所不同,所以如果它在一个上工作而不在另一个上工作,没有什么特别奇怪的。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM