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