应用程序从推送通知收到的alertView打开后冻结应用程序

时间:2015-07-07 05:18:04

标签: ios objective-c

我已将APNS嵌入到我的应用中,然后导航到一个屏幕,其中显示了通知的详细信息。问题是,当单击警报视图中的视图按钮时,应用程序将导航到.xib文件并冻结。 我该怎么做才能解决这个问题? 下面是用于打开viewController xib的代码:

RearTableViewController *rearView = [[RearTableViewController alloc]initWithNibName:@"RearTableViewController" bundle:nil];
    DetailsViewController *detailsViewController = [[DetailsViewController alloc]initWithNibName:@"Details" bundle:nil];
    detailsViewController.messageID = [[[NSUserDefaults standardUserDefaults] objectForKey:@"messageId"] intValue];
    UINavigationController *frontNavigationController = [[UINavigationController alloc] initWithRootViewController:detailsViewController];
    UINavigationController *rearNavigationController = [[UINavigationController alloc] initWithRootViewController:rearView];

SWRevealViewController *mainRevealController = [[SWRevealViewController alloc]
                                                initWithRearViewController:rearNavigationController frontViewController:frontNavigationController];

mainRevealController.delegate = self;
self.window.rootViewController = mainRevealController;

1 个答案:

答案 0 :(得分:0)

这可以帮到你。

self.window = [[UIWindow alloc]initWithFrame:[[UIScreen mainScreen] bounds]];
    SplashVC *rootVC = [[SplashVC alloc]initWithNibName:@"SplashVC" bundle:nil];
    UINavigationController *navigation = [[UINavigationController alloc]initWithRootViewController:rootVC];
    [navigation setNavigationBarHidden:YES];
    self.window.rootViewController = navigation;
    [self.window makeKeyAndVisible];

当我收到推送和显示提醒时,这是我的代码。如果按下其中一个按钮,则会显示我的视图控制器。

LocationViewController *locationVC = [storyboard instantiateViewControllerWithIdentifier:@"LocationVC"];
                                  locationVC.latitude = fLat;
                                  locationVC.longitude = fLong;
                                  [self.navController presentViewController:locationVC animated:YES completion:nil];