【发布时间】:2013-11-03 01:32:33
【问题描述】:
我是 iOS 开发新手。我想在应用处于非活动状态时显示接收推送通知的警报视图。
Apple 表示推送通知可以以警报消息的形式呈现,或者他们可以标记应用程序图标。
我正在使用PushSharp 发送推送通知。但通知仅在通知中心可见。我应该怎么做才能在 alertview 上显示它?
我知道我们可以写一个代码来显示像这样的警报视图
-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"test title" message:@"test message" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Ok", nil];
[alert show];
}
但此代码是在我点击通知和应用启动后执行的。我想在设备收到推送通知后立即显示alertview。
还有一个问题,Apple 是否支持任何方式在应用未启动的情况下接收推送通知时执行代码?
有什么想法吗?
【问题讨论】:
标签: ios push-notification