6

我面临通知问题。通知在过去 12 小时内未显示在设备中。它早些时候工作。发送到其他设备工作正常。我检查了通知中心和其他东西。已为应用启用通知。

在关注 http://developer.apple.com/library/ios/#technotes/tn2265/_index.html之后 ,我启用了在 iOS 上启用推送状态消息。

在控制台上,设备正在打印一些信息,例如:

<Error>: kDataAttachStatusNotification sent, wasAttached: 1 isAttached: 1

这是什么意思 ?它是否从服务器端收到通知并且由于某种原因无法显示和接收?

编辑:使用 iTunes 同步日志后。日志这样说:

2013-08-01 10:51:06 +0530 apsd[76]: _getClientIdentity: already had identity: <SecIdentityRef: (some value here)>
wasUp NO isUp NO linkQualityBelowAndWOWAvail: YES wantsInterfaceAssertion YES  avoidWWANOnCall NO
2013-08-01 10:51:06 +0530 apsd[76]: _getClientIdentity: already had identity: <SecIdentityRef: (some value here)>
2013-08-01 10:51:06 +0530 apsd[76]: peer(68) received XPC_ERROR_CONNECTION_INVALID
4

1 回答 1

0

您是否请求用户允许显示通知?

尝试将以下代码添加到 AppDelegate 的application: didFinishLaunchingWithOptions:方法中:

迅速:

 if (UIApplication.instancesRespondToSelector(Selector("registerUserNotificationSettings:"))) {
    application.registerUserNotificationSettings(UIUserNotificationSettings(forTypes: .Alert, categories: nil))
 }

目标-C:

if ([application respondsToSelector:@selector(registerUserNotificationSettings:)]) {
    [application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert categories:nil]];
}
于 2015-02-28T19:43:28.523 回答