0

Ich arbeite an Push-Benachrichtigung mit Azure Notification Hub.Wenn App im Hintergrund und Push-Benachrichtigung erhalten tippen Sie auf App stürzt ab

Ich möchte meine App von AppDelegate starten, wo die Benachrichtigung Tap ist.

Hier ist das Szenario, wie ich meine App öffnen kann.

AppDelegate.cs Datei

public class AppDelegate : UIApplicationDelegate 
    { 
     // class-level declarations 
     private SBNotificationHub Hub { get; set; } 

     public bool appIsStarting = false; 

     public SlideoutNavigationController Menu { get; private set; } 


     public override UIWindow Window 
     { 
      get; 
      set; 
     } 

     public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) 
     { 
      if (launchOptions != null) 
      { 
       // check for a remote notification 
       if (launchOptions.ContainsKey(UIApplication.LaunchOptionsRemoteNotificationKey)) 
       { 

        NSDictionary remoteNotification = launchOptions[UIApplication.LaunchOptionsRemoteNotificationKey] as NSDictionary; 
        if (remoteNotification != null) 
        { 
         Window = new UIWindow(UIScreen.MainScreen.Bounds); 
         Menu = new SlideoutNavigationController(); 

         var storyboard = UIStoryboard.FromName("Main", null); 
         var webController = storyboard.InstantiateViewController("DashBoardViewController") as DashBoardViewController; 

         Menu.MainViewController = new MainNavigationController(webController, Menu); 
         Menu.MenuViewController = new MenuNavigationController(new DummyControllerLeft(), Menu) { NavigationBarHidden = false }; 

         Window.RootViewController = Menu; 
         Window.MakeKeyAndVisible(); 
        } 
       } 
       ReceivedRemoteNotification(application, launchOptions); 

      } 
      else 
      { 

       UIApplication.SharedApplication.SetStatusBarStyle(UIStatusBarStyle.LightContent, false); 
       UIApplication.SharedApplication.ApplicationIconBadgeNumber = 0; 
      } 

      UNUserNotificationCenter.Current.Delegate = new UserNotificationCenterDelegate(); 

      return true; 
     } 
} 

UserNotificationCenterDelegate.cs Datei

class UserNotificationCenterDelegate : UNUserNotificationCenterDelegate 
    { 

     public SlideoutNavigationController Menu { get; private set; } 



     #region Constructors 
     public UserNotificationCenterDelegate() 
     { 
     } 
     #endregion 

     #region Override Methods 
     public override void WillPresentNotification(UNUserNotificationCenter center, UNNotification notification, Action<UNNotificationPresentationOptions> completionHandler) 
     { 
      // Do something with the notification 
      Console.WriteLine("Active Notification: {0}", notification); 


      // Tell system to display the notification anyway or use 
      // `None` to say we have handled the display locally. 
      completionHandler(UNNotificationPresentationOptions.Alert); 
     } 

     public override void DidReceiveNotificationResponse(UNUserNotificationCenter center, UNNotificationResponse response, Action completionHandler) 
     { 
      base.DidReceiveNotificationResponse(center, response, completionHandler); 
     } 

     #endregion 
    } 

ich alle möglichen Szenario versucht haben, die ich auf Google gefunden und so und andere Seite, aber nichts funktioniert für mich.

Ich verbrachte 4 Tage auf diesem aber nicht Erfolg.

Jede Hilfe wird geschätzt.

+0

Haben Sie die Protokolle auch mit Haltepunkt ....? –

+0

können Sie teilen, was ist das Crash-Protokoll, wenn Sie versuchen, zu öffnen. –

+0

@GouravJoshi Ich teste auf den Release-Modus, so dass Breakpoint nicht funktioniert. – Ironman

Antwort

0

Haben Sie in DeviceLogs eingecheckt Fenster-> Geräte-> Geräteprotokolle anzeigen? Es muss ein Absturz protokolliert werden.

+0

Verwenden Sie ein Framework wie Crashlytics, SplunkMint. Es hilft wirklich bei der Protokollierung von Abstürzen auf dem Sprung. –

+0

Ich bin im Release-Modus bereitstellen, also keine Option verfügbar. – Ironman

+0

Nur zur Information, wollen Sie nicht Absturzberichte von Live-App-Nutzern erhalten? –