【发布时间】:2015-05-03 02:30:30
【问题描述】:
当应用程序通过推送通知启动时,我正在尝试打开子视图(PostReaderViewController,Image 上的第四个视图)。故事板图像: 这是我的代码:
- (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;
}
当我通过推送通知启动我的应用程序时,没有显示错误,但不幸的是它启动并显示默认视图(图像上的第三个视图)。
请注意,我使用的是SWRevealMenu,初始点(图像上的第一个视图)是显示视图控制器
【问题讨论】:
标签: ios objective-c iphone uinavigationcontroller swrevealviewcontroller