我需要在单击通知时打开一个视图控制器。我可以推送到垂直的ViewController,但是我在api响应方面遇到了问题。
当我通过应用内或POSTMAN打开View Controller时,该api可以正常工作。
但是当我使用fcm willPresentNotification方法打开相同的视图时,它总是会使连接超时。
有什么建议吗?
- (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler{
//For notification Banner - when app in foreground
completionHandler(UNNotificationPresentationOptionAlert);
NSDictionary *userInfoDict = notification.request.content.userInfo;
NSString *notificationFor = [userInfoDict valueForKey:@"gcm.notification.isWho"];
NSString *doctorQuestionId = [userInfoDict valueForKey:@"gcm.notification.doctor_question_id"];
NSLog(@"dcot ==%@",doctorQuestionId);
UINavigationController *navController = (UINavigationController *)self.window.rootViewController;
UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle: nil];
QuizVC *vc = [mainStoryboard instantiateViewControllerWithIdentifier:@"QuizVC"];
vc.fromNotification = @"Yes";
vc.doctorQuestionID = doctorQuestionId;
[navController pushViewController:vc animated:YES];
}