Today extension crashes on REST call

We have a today extension on iOS that needs to do some REST calls to get some data. It is build upon the same API as we use in the container app, but it is not too complex code though.

The problem is, that the Today extension crashes. I've traced it down to calling the REST call. Actually it it when awaiting the call to finish to crashes. No logs or error messages - just crashes and detaches the debugger. It is not even caught in the try block.

Now the weird thing is that it works flawlessly in the simulator but not on actual devices (tried with iPhone 7s iOS12 and iPhone X iOS11.4.1)

Heres the code where it crashes:

     Task<IRestResponse> t = restClient.Execute (request);
     try {
        await t; // <----- HERE IS WHERE IT CRASHES
            logRequest ( request, t.Result);
    }
        catch (Exception e ) {
        logRequest (request, null, e);
    }

Any help, directions, pointers is highly appreciated as we are closing in on a deadline.

Thanks

Answers

  • ColeXColeX Member, Xamarin Team Xamurai

    I suggest you use App Center to analyse the crash .

  • FunderFunder Member

    Thank you for your suggestion ColeX

    Im not sure App Center supports extensions as extensions are separate projects running it's own process. At least I do not know how to implement it in a today extension.

    I tried implementing AppCenter in the container app but get no crash reports.
    I also tried implementing it in the extension project, but as there are no AppDelegate there, I had to put inside the main Controllers ViewDidLoad method. This seems to make the extension crash even sooner.

    So I'm still stuck on this issue.

  • JGoldbergerJGoldberger USMember, Forum Administrator, Xamarin Team, University Xamurai

    @Funder

    I would suggest looking at the device's console log. What is likely happening is you are getting a native crash that kills the extension before the exception can even bubble up to the managed code side of things. The device console logs may provide more insight.

    You can view the live device logs in the Console.app on your Mac build host, or in the Device Log pane in Visual Studio.

    Device console logs

    Visual Studio Windows:
    1. Use the View->Other Windows->Device Log menu to launch the Device Log pane.
    2. Choose the device in the Choose Device drop down list at the top of the pane.

    Visual Studio Mac:
    1. Use the View->Pads->Device Log menu to launch the Device Log pane.
    2. Choose the device in the Choose Device drop down list at the top of the pane.

    or open Console.app on your Mac and select your simulator/device on the left.

Sign In or Register to comment.