推送通知在iOS 8.3中不起作用
问题描述:
我的推送通知在ios 8.3中不起作用.我已经在xcode 6.0中构建了支持ios 8.0的项目.是原因吗?
My Push Notification is not working in ios 8.3. I had build the project in xcode 6.0 which support upto ios 8.0. is it the Reason???
答
///ios8通知的条件...
// This conditions for ios8 notifications...
if ([[UIApplication sharedApplication] respondsToSelector:@selector(registerUserNotificationSettings:)])
{
[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
[[UIApplication sharedApplication] registerForRemoteNotifications];
}
else
{
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)];
}
您将其放在- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
???
将其放入并检查.应该可以.
Put this and check. It should work.