ios - Get to specific tabView object from App Delegate -
trying launch specific tabview object app delegate when receive notification, app crashes on launch.
here code:
uistoryboard *storyboard = [uistoryboard storyboardwithname:@"main" bundle:nil]; uiviewcontroller *viewcontroller; customtabviewcontroller * tabbar = [[customtabviewcontroller alloc] init]; nsdictionary *notificationpayload = launchoptions[uiapplicationlaunchoptionsremotenotificationkey]; nsstring *type = [notificationpayload objectforkey:@"type"]; if([type isequaltostring:@"friend"]){ tabbar.selectedviewcontroller = [tabbar.viewcontrollers objectatindex:2]; self.window.rootviewcontroller = tabbar; [self.window makekeyandvisible]; } if([type isequaltostring:@"message"]){ tabbar.selectedviewcontroller = [tabbar.viewcontrollers objectatindex:0]; self.window.rootviewcontroller = tabbar; [self.window makekeyandvisible]; }
any ideas?
Comments
Post a Comment