2
我试图设置我的应用程序以接收来自GCM的推送通知。当应用程序在前台运行在AppDelegate中的方法调用:当应用程序在后台时不显示推送通知
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
DLog(@"Notification received: %@", userInfo);
// This works only if the app started the GCM service
[[GCMService sharedInstance] appDidReceiveMessage:userInfo];
completionHandler(UIBackgroundFetchResultNoData);
}
示例日志是这样的:
Notification received: {
aps = {
alert = "myk myk";
badge = 2;
sound = default;
};
"gcm.message_id" = "0:1446730003823773%cc4efdeacc4efdea";
}
的问题是,当我的应用程序是在后台有在没有信息所有人都在通知中心,没有警告/横幅正在显示。我检查了设置 - >通知和通知为我的应用程序启用。当我进入我在后台的应用程序时,我有关于通知的信息,但这不是我想要的。
我使用iOS 9.0.1和xCode 7.1 为什么当我的应用程序在后台时没有通知横幅?
当你的应用程序在后台didFinishLaunchingWithOptions开始实施时,在那里显示你的代码......你是否解决了这个问题? – XcodeNOOB