Giter Site home page Giter Site logo

Comments (5)

aritchie avatar aritchie commented on June 11, 2024

Include a reproducible sample or it didn't happen

from shiny.

cburns-pw avatar cburns-pw commented on June 11, 2024

How do you suggest I include a reproducible sample that includes Apple certificates to send push notifications?
If I change this delegate:

[Export("application:didReceiveRemoteNotification:fetchCompletionHandler:")]
    public void DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo, Action<UIBackgroundFetchResult> completionHandler) 
        => Host.Lifecycle.OnDidReceiveRemoteNotification(userInfo, completionHandler);

to

[Export("application:didReceiveRemoteNotification:fetchCompletionHandler:")]
public void DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo, Action<UIBackgroundFetchResult> completionHandler) 
{
    Debug.WriteLine(userInfo);
}

The app prints userInfo and the app does not crash.

from shiny.

aritchie avatar aritchie commented on June 11, 2024

You don't have to include the certs. I don't need them. If you don't file a repro, I will close this though. Please be respectful of the issue template.

from shiny.

cburns-pw avatar cburns-pw commented on June 11, 2024

You don't have to include the certs. I don't need them. If you don't file a repro, I will close this though. Please be respectful of the issue template.

I updated with a repo.

from shiny.

cburns-pw avatar cburns-pw commented on June 11, 2024

I decided to pull the shiny repo and add it to my project to try to figure out what was wrong.
I believe I found what is causing it.
You can't Invoke the completion handler more than once or at least this part of the code is what is causing the app the terminate:

    public void OnDidReceive(NSDictionary userInfo, Action<UIBackgroundFetchResult> completionHandler)
    {
        this.logger.LogDebug("Incoming Background remote notification");

        var dict = userInfo.FromNsDictionary();
        var data = new PushNotification(dict, null);
        this.services
            .RunDelegates<IPushDelegate>(
                x => x.OnReceived(data),
                this.logger
            )
            .ContinueWith(_ => completionHandler.Invoke(UIBackgroundFetchResult.NewData));

        completionHandler.Invoke(UIBackgroundFetchResult.NewData);
    }

Removing completionHandler.Invoke(UIBackgroundFetchResult.NewData); results in a successful background fetch.

from shiny.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.