0

i'm trying to release an app on the Apple Store, this app use push notification to send some important information to the user.

I have been trying some guides to make the push notification work correctly on a device. Notice on developer mode the push notification work ok, but in production mode the're not. When the device receives the notification the app closes and the error that i get this:

TestApp.iOS.AppDelegate.DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo, Action completionHandler) UIKit.UIApplication.UIApplicationMain(int, string[], intptr, intptr)(wrapper managed-to-native) UIKit.UIApplication.Main(string[] args, string principalClassName, string delegateClassName) TestApp.iOS.Application.Main(string[] args)

System.NullReferenceException: Object reference not set to an instance of an object

this is specific line is that causing the null ref... that show before.. but i don't have idea why ?? :(

public override void DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo, Action<UIBackgroundFetchResult> completionHandler)
{
    Messaging.SharedInstance.AppDidReceiveMessage(userInfo);

    // Generate custom event
    NSString[] keys = { new NSString("Event_type") };
    NSObject[] values = { new NSString("Recieve_Notification") };
    var parameters = NSDictionary<NSString, NSObject>.FromObjectsAndKeys(keys, values, keys.Length);

    // Send custom event
    Firebase.Analytics.Analytics.LogEvent("CustomEvent", parameters);

    if (application.ApplicationState == UIApplicationState.Active)
    {
        System.Diagnostics.Debug.WriteLine(userInfo);
        var aps_d = userInfo["aps"] as NSDictionary;
        var alert_d = aps_d["alert"] as NSDictionary;
        var body = alert_d["body"] as NSString;
        var title = alert_d["title"] as NSString;
        debugAlert(title, body);
    }


}

The guides i was trying...but without much luck, they did not work for me..

and official resources..

i have FirebaseAppDelegateProxyEnabled disable...

i have the capabilities enable background modes.. and remote notification correctly active...

i have correctly configuration my credential/certificate. and profile.....

but omg i don't know what happens with the notification please give me a suggestion for resolve this..

library version that i use....

http://qiita.com/yamachu/items/cee6104ac579ea657deb

my Entitlements.plist

aps-environment production

3pa2
  • 5
  • 1
  • 4
  • You need to step through your code and determine which specific line is causing the null ref – Jason Sep 13 '17 at 19:27
  • this line: public override void DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo, Action completionHandler) i show you above. Thank you very much for answering – 3pa2 Sep 13 '17 at 19:41
  • no, that is just telling you which method caused the exception, not which specific line – Jason Sep 13 '17 at 19:55
  • ohh okay Thank ...i try to solve this on this moment but i don't figure out how to do this... but I will keep informed – 3pa2 Sep 13 '17 at 20:02
  • I suggest you can remove part of the code to figure out which line causes the error, and could you attach the text info (push notification)? – ColeX Sep 14 '17 at 05:48

0 Answers0