objective c - Open a specific view controller in the storyboard when notification is tapped in ios -
i have app needs open specific view controller when notification tapped. here's have tried:
in case, if use app crashes when tap notification.
if([[[userinfo objectforkey:@"aps"]objectforkey:@"alert"] isequaltostring:@"you've got mail!"]) { mtnotificationviewcontroller *profile = [[mtnotificationviewcontroller alloc] initwithnibname:@"mtnotificationviewcontroller" bundle:nil]; [self.window.rootviewcontroller presentviewcontroller: profile animated:yes completion:nil]; }
if use app doesn't redirect view controller want load. tried putting code in if statement check if app uiapplicationstateinactive , uiapplicationstatebackground still same result.
if([[[userinfo objectforkey:@"aps"]objectforkey:@"alert"] isequaltostring:@"you've got mail!"]) { mtnotificationviewcontroller *profile = [[mtnotificationviewcontroller alloc] initwithnibname:@"mtnotificationviewcontroller" bundle:nil]; [navigation.visibleviewcontroller.navigationcontroller pushviewcontroller:profile animated:yes]; }
can please me. thanks!
Comments
Post a Comment