Ich implementiere Remote-Benachrichtigungen für meine iOS-App und versuche, Benachrichtigungs-Payloads zu erfassen, wenn die App nicht ausgeführt wird. Das Problem besteht darin, dass beim Start von FinishedLaunch der Parameter launchOption immer null ist. In anderen Fällen, wenn die App im Hintergrund oder aktiv ist, funktionieren Benachrichtigungen gut. Ich verstehe nicht warum, basierend auf Referenzen und Blog-Posts, sollte es funktionieren. Dies ist der Code, den ich verwende:LaunchOption in FinishedLaunching immer null (Xamarin.iOS)
public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)
{
//new UIAlertView("launchOption", launchOptions != null ? "Yes" : "No", null, "").Show();
if(launchOptions != null && launchOptions.ContainsKey(UIApplication.LaunchOptionsRemoteNotificationKey))
{
//new UIAlertView("launchOption", "launchOption != null", null, "");
this.viewModel.Loading(false);
NSObject result;
if (launchOptions.TryGetValue (UIApplication.LaunchOptionsRemoteNotificationKey, out result)){
NSNotification notification = result as NSNotification;
DispatchPushNotification(application, notification.UserInfo);
Console.WriteLine ("Got a local notification: {0}", notification);
}
...
Was mache ich falsch?
hast du eine Lösung dafür gefunden ?, ich stehe auch vor einem ähnlichen Problem – Subha