未收到 iOS 推送通知
<p><p>后端 - Django</p>
<p>前端 -objective-c (X 代码)</p>
<p>我关注了<a href="https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppDistributionGuide/ConfiguringPushNotifications/ConfiguringPushNotifications.html" rel="noreferrer noopener nofollow">this</a> Apple Document 配置推送通知并成功完成所有步骤。 </p>
<p>对于后端,我使用 <a href="https://github.com/jleclanche/django-push-notifications" rel="noreferrer noopener nofollow">django-push-notifications</a>使用Django==1.7,发送消息时不会出错。</p>
<p>对于前端,我添加了以下几行来接收通知,</p>
<pre><code> UIUserNotificationType userNotificationTypes = (UIUserNotificationTypeAlert |
UIUserNotificationTypeBadge |
UIUserNotificationTypeSound);
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:userNotificationTypes
categories:nil];
;
;
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
NSString *token = [ stringByTrimmingCharactersInSet: ];
token = ;
NSLog(@"content---%@", token);
UIAlertView *alert = [ initWithTitle:@"DeviceToken!!!" message:token delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil];
;
}
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
....
}
</code></pre>
<p>但在此之后,我无法收到通知。我是否正确完成并配置了步骤?我的 X 代码版本是 6.3,苹果设备的 iOS 版本是 8.4。两者都应该是兼容的版本来接收通知吗? </p>
<p>有没有办法在 APNs 云上记录或查看进度? </p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>使用<strong>deviceToken</strong>直接点赞</p>
<pre><code>- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken {
NSLog(@"My token is: %@", deviceToken);
}
</code></pre>
<p>您还需要确保发送推送通知。</p>
<p>尝试使用 <a href="http://www.hrf-apps.com/support.html" rel="noreferrer noopener nofollow">this tutorial</a>以及他们的应用程序,它将帮助您确保正确发送 Push 并且您需要修复前端。 </p></p>
<p style="font-size: 20px;">关于未收到 iOS 推送通知,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/31176955/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/31176955/
</a>
</p>
页:
[1]