我試圖打開子視圖(PostReaderViewController,圖像上的第四個視圖)當應用程序通過推送通知午餐時它是。故事板圖片: 這是我的代碼:Performe,導航,從應用程序委託子視圖
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
...
//Detecting if the app was lunched by clicking on push notification :
NSDictionary *userInfo = [launchOptions valueForKey:@"UIApplicationLaunchOptionsRemoteNotificationKey"];
NSDictionary *apsInfo = [userInfo objectForKey:@"aps"];
if(apsInfo) {
UIStoryboard *mainstoryboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
PostReaderViewController* postReader = (PostReaderViewController *)[mainstoryboard instantiateViewControllerWithIdentifier:@"postReaderView"];
CostumSDPost *tempPost = [[CostumSDPost alloc] init];
tempPost.ID = userInfo[@"post_id"];
postReader.thePost = tempPost;
[self.window.rootViewController presentViewController:postReader animated:YES completion:NULL];
//userInfo[@"post_id"]);
}
return YES;
}
當我通過推送通知啓動我的APP沒有錯誤顯示,但它unfortunly啓動並顯示默認的視圖(圖像第三視圖)。
請注意,我使用SWRevealMenu和INTIAL點(圖像查看首)是顯示視圖控制器