9

मुझे पता होना चाहिए कि पुश अधिसूचना प्राप्त होने पर मुख्य दृश्य नियंत्रक के बजाय एक और दृश्य नियंत्रक कैसे खोलें, कृपया मुझे पहले से धन्यवाद में मदद करें, मेरा कोड "धक्का अधिसूचना प्राप्त होने पर मुख्य स्क्रीन के एक और स्क्रीन को कैसे खोलें

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 
    sleep(2); 
    [[UIApplication sharedApplication] registerForRemoteNotificationTypes: 
(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound)]; 

    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 
    // Override point for customization after application launch. 
    NSUserDefaults* ud = [NSUserDefaults standardUserDefaults]; 
    consumerId = [[ud objectForKey:@"consumerId"] intValue]; 

    couponSql = [[CouponsSqlClass alloc] init]; 

    if (consumerId == 0) { 
     self.viewController = [[LandingPageViewController alloc] initWithNibName:@"LandingPageViewController" bundle:nil]; 
     self.window.rootViewController = self.viewController; 
    } 
    else { 
     application.applicationIconBadgeNumber = 0; 

     EditProfileViewController* mainViewController = [[EditProfileViewController alloc] initWithNibName:@"EditProfileViewController" bundle:nil]; 
     _mainViewNavController = [[UINavigationController alloc] initWithRootViewController:mainViewController]; 
     KluebookMenuViewController* leftSideMenuViewController = [[KluebookMenuViewController alloc] initWithNibName:@"KluebookMenuViewController" bundle:nil]; 
     self.deskController = [[IIViewDeckController alloc] initWithCenterViewController:self.mainViewNavController leftViewController:leftSideMenuViewController]; 
     self.deskController.leftLedge = 60; 
     self.window.rootViewController = self.deskController; 
    } 
    [self.window makeKeyAndVisible]; 

    return YES; 
} 

उत्तर

4
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 

    if (launchOptions != nil) { 
     // Launched from push notification 
     NSDictionary *notification = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey]; 
     //Redirect it to your page here 
    } 
} 

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo 
{ 
    if (application.applicationState == UIApplicationStateInactive || application.applicationState == UIApplicationStateBackground ) 
    { 
     //opened from a push notification when the app was on background 
     //Redirect it to your page here 
    } 
} 
संबंधित मुद्दे