標籤:style io os 使用 ar for sp on log
// IOS8 新系統需要使用新的代碼註冊推送
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
{
[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings
settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge)
categories:nil]];
[[UIApplication sharedApplication] registerForRemoteNotifications];
}
else
{
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)];
}
判斷PUSH是否開啟的方法是:
//判斷推送是否開啟
if (isiOS8)
{
UIUserNotificationType type = [application currentUserNotificationSettings].types;
if (type) {
}else
{
}
NSLog(@"------- 推送類型 ------%d",type);
}
else
{
UIRemoteNotificationType type = [application enabledRemoteNotificationTypes];
if (type) {
}else
{
}
NSLog(@"------- 推送類型 ------%d",type);
}
iOS8遠程通知處理