【发布时间】:2014-06-06 19:29:15
【问题描述】:
在我的应用程序中,我使用了推送通知服务,但我的问题是,当我当时关闭应用程序时会出现通知,但是当我打开应用程序然后发送通知时,通知不会出现。请帮帮我。
【问题讨论】:
标签: ios push-notification
在我的应用程序中,我使用了推送通知服务,但我的问题是,当我当时关闭应用程序时会出现通知,但是当我打开应用程序然后发送通知时,通知不会出现。请帮帮我。
【问题讨论】:
标签: ios push-notification
您可以在appDelegate.m中通过下面提到的此功能轻松处理
---实现application:didReceiveRemoteNotification:
示例:-
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
UIApplicationState appState = [application applicationState];
if (appState == UIApplicationStateActive)
{
UIAlertView *alertVw = [[[UIAlertView alloc] initWithTitle:@"Notify" message:yourMessage delegate:self cancelButtonTitle:@"Done" otherButtonTitles: @"vizllx", nil] autorelease];
[alertVw show];
}
else {
// Push Notification received while app is in background
}
}
【讨论】: