iOS - 通知(本地/远程)只需打开应用,不显示提醒

时间:2015-04-27 05:02:59

标签: ios notifications

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

但是当我按下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.]

任何人都有解决方案或面临这样的问题。

谢谢

1 个答案:

答案 0 :(得分:2)

尝试使用此代码对您有所帮助,您可以在 didFinishLaunchingWithOptions

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

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