iOS - 通知(本地/远程)只是打开应用程序,不显示警报

iOS - notifications (local / remote) just open the app, not showing alerts

我的应用程序接收本地和远程的所有通知。并且还可以正常显示警报。

但是当我按下 Home 按钮并从应用程序堆栈或最近的应用程序中删除应用程序时。之后收到任何通知,我的应用程序通知我通知栏中的通知。当我点击通知时,这只是打开我的应用程序(不显示警报)。 [When app is in app Stack / recent apps and any notification arrives and after tapping on this will open the app and also show me alerts.]

任何人都有这样的解决方案或遇到过这样的问题。

谢谢

试试这个代码,它会对你有所帮助,你会在 didFinishLaunchingWithOptions

中获得通知信息
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

UILocalNotification *localNotif =[launchOptions objectForKey: UIApplicationLaunchOptionsRemoteNotificationKey];
if(localNotif) {
//get notification info
localNotif.userinfo
}
 return YES;
}