1
votes

I am making an application which shows a UILocalNotification and when user clicks on the notification, the app will show a new ViewController (designed in Storyboard) which doesn't have any segue from anywhere in my application.

To detect if the user has clicked on the notification I am doing the following in didReceiveLocalNotification :

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
UIViewController *checkListVC = [storyboard instantiateViewControllerWithIdentifier:@"MyCheckListVC"];
self.window.rootViewController = checkListVC;

So when user clicks on the notification, above code initiatizes my view controller (lets call it CheckListVC) which has the identifier "MyCheckListVC". This CheckListVC has tableView, whose delegate and dataSource methods get called (numberOfRowsInSection & cellForRowAtIndexPath) when the view controller is initialized. But the problem is the simulator shows blank screen when CheckListVC is initialized instead of showing tableView.

I am not able to debug it because I don't even know where the problem is. The view controller gets initialized properly and all the delegate/dataSource methods are getting called properly, but the screen goes blank.

1
did you call [self.window makeKeyAndVisible] after you set your rootViewController, this could be the problem.limon
Yes I did call [self.window makeKeyAndVisible] but it doesn't help either.nefarianblack

1 Answers

0
votes

I think you forgot to assign identifier to UIStoryboard.. 1.select storyboard 2.assign the identifier name in "MyCheckListVC" in Identity inspector ..

check this image for clarity..

enter image description hereenter image description here

follow these steps and try.. i think this will work.. :)