簡體   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