我在我的应用中使用了easyapns进行推送服务。 Push在iOS 8上工作正常,但我的客户说推送不能在iPhone 6上运行。我没有iPhone 6进行检查。其他人会遇到同样的问题吗?什么可能会出错?Push无法在iPhone 6上工作
3
A
回答
2
以下是我在iOS 8和iPHONE 6/6 +上工作的内容。 iOS 8改变了推送通知注册的方式。以下代码将允许设备注册iOS 8和iOS 8前设备上的推送通知。
将此代码放在您的appDelegate.m在didFinishLaunchingWithOptions:
#ifdef __IPHONE_8_0
if ([[UIApplication sharedApplication] respondsToSelector:@selector(registerUserNotificationSettings:)]) {
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeBadge|UIUserNotificationTypeSound|UIUserNotificationTypeAlert categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:settings];
} else {
UIRemoteNotificationType myTypes = UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound;
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:myTypes];
}
#else
UIRemoteNotificationType myTypes = UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound;
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:myTypes];
#endif
此外,在您的appDelegate.m添加为一个新的方法
#ifdef __IPHONE_8_0
- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings
{
[application registerForRemoteNotifications];
}
#endif
让我知道如何工作的。
相关问题
- 1. iOS 8 Today Extension无法在iPhone 6和6+设备上工作
- 2. MKMapView clipsToBounds无法在iOS上工作6
- 3. 在模拟器上工作,但无法在iPhone上工作
- 4. 在模拟器上工作,无法在iPhone设备上工作
- 5. AVAudioRecorder无法在iPhone 5S上工作
- 6. glReadPixels无法在iPhone上工作
- 7. YOXView无法在iPhone上工作
- 8. iOS:Audio Unit RemoteIO无法在iPhone上工作
- 9. jQuery动画无法在iPhone上工作
- 10. jQuery验证无法在iPhone上工作
- 11. CSS Box Shadow无法在iPhone上工作
- 12. jQuery jCarousel无法在iPhone上工作
- 13. innerHTML无法在iPhone上工作
- 14. html5验证无法在iphone上工作
- 15. Joomla网站上的菜单链接无法在iPhone 6 Plus上工作
- 16. jQuery $ .each push(this)无法正常工作
- 17. 通过画布html5调整图像无法在iPhone 6或7上工作,但在Android上工作?
- 18. Isapi过滤器无法在IIS 7上工作(它在IIS 6上工作)
- 19. '克隆()`无法在Internet Explorer工作6
- 20. UISearchBar无法在IOS 6 Popover中工作
- 21. 无法使servlet在Tomcat中工作6
- 22. QLPreviewController无法在iOS 6中工作
- 23. iPhone - Grand Central Dispatch在iPhone 4S上无法正常工作
- 24. 工作灯和iPhone 6月6日加
- 25. Sqlite无法在实际设备上工作(在我的iPhone上)
- 26. ARC正在iOS 6中工作,但无法在iOS5.1中工作
- 27. 分享工具包Twitter无法在iPhone上工作
- 28. 无限滚动无法在iphone上工作
- 29. PKCS#11引擎在openssl上无法工作6
- 30. Viewbag无法在IIS 6服务器上工作2003
是否有可能在系统设置中禁用了您的应用的通知? – Greg 2014-10-06 13:01:12
不,通知仍然是他仍然没有收到push.FYI它在iPhone 5s ios8设备工作正常 – va05 2014-10-06 13:04:51
这听起来像一个软件问题,而不是硬件问题。也许应用程序没有正确注册通知,或者用户不小心拒绝启用它们,并且您的应用程序未对设置中随后启用的通知作出适当的响应。 – Greg 2014-10-06 13:28:16