我的問題是當我重定向到另一個視圖控制器的數據未來。所以請幫助我..打開視圖控制器當推送通知收到或重定向到另一個視圖控制器
AppDelegate.m
我有聲明這樣
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
NSDictionary *segueDictionary = [userInfo valueForKey:@"aps"];
NSString *segueName=[[NSString alloc]initWithFormat:@"%@",[segueDictionary valueForKey:@"vendor_data"]];
if ([[UIApplication sharedApplication] applicationState] == UIApplicationStateActive)
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@" Offers"
message:[NSString stringWithFormat:@"%@",[[userInfo objectForKey:@"aps"] objectForKey:@"alert"]]
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
}
else if ([[UIApplication sharedApplication] applicationState] == UIApplicationStateInactive || [[UIApplication sharedApplication] applicationState] == UIApplicationStateBackground)
{
MessageViewController * referObject = [[MessageViewController alloc]init];
//[self.navigationController pushViewController:referObject animated:YES];
UINavigationController *navController = (UINavigationController *)self.window.rootViewController;
[navController.visibleViewController.navigationController pushViewController:referObject animated:YES];
}
}
UIApplicationStateInactive
應用僅僅是開放的,它不是 重定向到MessageViewController
和UIApplicationStateBackground
應用程序被重定向到MessageViewController
我想訪問MessageViewController & 這裏MessageViewController是一個Xib
請幫我....
感謝
你的方法被調用或不 –
你的意思是navController.visibleViewController.navigationController? navController是否足夠? – Johnykutty
它是指揮,但什麼也沒有顯示,我是新來的iOS –