對於第一個,APNS不提供設備是否收到通知的任何回調。 如果你想要的話,你可以在你的設備上實現一些東西,告訴你的服務器收到通知。
對於第二個,你可以從這段代碼中獲得一些幫助。當應用程序在後臺從this answer.
這
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
if (application.applicationState == UIApplicationStateInactive || application.applicationState == UIApplicationStateBackground )
{
//opened from a push notification when the app was on background
}
}
更多幫助被調用。如果你想獲得信息,這由開始推送通知的應用程序,你需要使用下面的代碼,在您的didFinishLaunchingWithOptions
UILocalNotification *notification = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
if (notification) {
NSLog(@"app recieved notification from remote%@",notification);
[self application:application didReceiveRemoteNotification:(NSDictionary*)notification];
}else{
NSLog(@"app did not recieve notification");
}
這件事SI知道啊,我的問題是different.Please檢查一次。 – 2015-04-06 12:06:48