jfversluis / FilePicker-Plugin-for-Xamarin-and-Windows

FilePicker Plugin for Xamarin and Windows
MIT License
157 stars 80 forks source link

Error: App Crash on iOS #149

Closed farukaf closed 4 years ago

farukaf commented 5 years ago

The app crashs and close when tapping the event.

Works fine on debug mode with iOS simulator. Works fine with android

Event


private async void FrmAnexarArquivo_Tapped(object sender, EventArgs e)
        {
            try
            {
                FileData fileData = await CrossFilePicker.Current.PickFile();
                if (fileData == null)
                    return; // user canceled file picking

                //string fileName = fileData.FileName;
                //string contents = System.Text.Encoding.UTF8.g(fileData.DataArray);
                viewModel.FileData = fileData.DataArray;
                viewModel.FileName = fileData.FileName;

                //System.Console.WriteLine("File name chosen: " + fileName);
                //System.Console.WriteLine("File data: " + contents);
            }
            catch (Exception ex)
            {
                viewModel.FileName = "";
                await DisplayAlert("Erro", "Erro ao tentar ativar a câmera.\n" + ex.Message, "OK");
            }
        }

Device Log:


Time    Device Name Type    PID Tag Message
Sep 19 11:12:33 iPad-Test   Error   47  SpringBoard SecTrustEvaluate  [leaf IssuerCommonName SubjectCommonName]
Sep 19 11:12:44 iPad-Test   Warning 217 ReportCrash Saved type '109(109_PEMobile.iOS)' report (8 of max 25) at /var/mobile/Library/Logs/CrashReporter/PEMobile.iOS-2019-09-19-111244.ips
Sep 19 11:12:44 iPad-Test   Notice  217 ReportCrash Formulating report for corpse[216] PEMobile.iOS
Sep 19 11:12:44 iPad-Test   Error   217 Unknown 
Sep 19 11:12:44 iPad-Test   Warning 217 ReportCrash os_activity_diagnostic_for_pid() failed!
Sep 19 11:12:44 iPad-Test   Error   217 ReportCrash assertion failed: 13G36: libsystem_trace.dylib + 15927 [E82A6F2D-873A-39AD-8014-EDEB52248157]: 0x0
Sep 19 11:12:43 iPad-Test   Warning 23  UserEventAgent  163765174101: id=com.focopdv.pemobiledislab pid=216, state=0
Sep 19 11:12:43 iPad-Test   Warning 47  SpringBoard Application 'UIKitApplication:com.focopdv.pemobiledislab[0xa3c3]' crashed.
Sep 19 11:12:43 iPad-Test   Warning 47  SpringBoard HW kbd: Failed to set (null) as keyboard focus
Sep 19 11:12:43 iPad-Test   Warning 216 PEMobile.iOS    Unhandled managed exception: Objective-C exception thrown.  Name: NSInternalInconsistencyException Reason: Application initializing document picker is missing the iCloud entitlement. Is com.apple.developer.icloud-container-identifiers set?
Sep 19 11:12:43 iPad-Test   Warning 216 PEMobile.iOS    
Sep 19 11:12:43 iPad-Test   Warning 216 PEMobile.iOS    *** Assertion failure in -[UIDocumentPickerViewController _commonInitWithCompletion:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3512.60.12/UIDocumentPickerViewController.m:78
Sep 19 11:12:43 iPad-Test   Warning 216 PEMobile.iOS    Passed in type public.item doesn't conform to either public.content or public.data. If you are exporting a new type, please ensure that it conforms to an appropriate parent type.
Sep 19 11:12:33 iPad-Test   Error   1   com.apple.xpc.launchd   assertion failed: 13G36: launchd + 85529 [083E000D-4C31-3B98-A2C4-6FADB4D1940F]: 0x3
Sep 19 11:12:33 iPad-Test   Notice  0   kernel  xpcproxy[216] Container: /private/var/mobile/Containers/Data/Application/23FC9D02-B374-4073-9CBF-C7B0A1CD69D6 (sandbox)
Sep 19 11:12:33 iPad-Test   Error   47  SpringBoard SecTrustEvaluate  [leaf IssuerCommonName SubjectCommonName]
vividos commented 5 years ago

Hi, I think the relevant part of the error log is this:

NSInternalInconsistencyException Reason: Application initializing document picker is missing the iCloud entitlement. Is com.apple.developer.icloud-container-identifiers set?

I think the readme.md file explains how to set that entitlement.

farukaf commented 5 years ago

Thank you very much for the fast answer.

iCloud is enabled on entitlement. What services I have to enable?

Just so you can see how I'm testing it. I got one iPad connected on a MacMini and from Visual Studio on a windows machine I'm deploying the app on release. The app starts and works fine until I tap the event.

jfversluis commented 4 years ago

Closing this since this project will retire, please check out Xamarin.Essentials which now has a FilePicker based on this one.