zoukankan      html  css  js  c++  java
  • iOS7、iOS8推送通知的区别

    iOS8版本以后的推送通知代码
    [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
    //注意下面这句,在iOS8 中注册推送通知必须要加上[[UIApplication sharedApplication] registerForRemoteNotifications];
    iOS8版本以前的推送通知代码
    [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)];
    如果要同时兼容iOS7 与 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)];    
    }
    ios8 横屏状态栏不显示

    解决方法:在plist文件中将 View controller-based status bar appearance 设置为NO  在application:didFinishLaunchingWithOptions:中添加下面代码[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
    [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone]; 
    iOS8 横屏的时候系统默认隐藏了  。。这个是ios8新特性 

    地图
     
    友盟分享  分享到微信注意点
  • 相关阅读:
    BZOJ1119: [POI2009]SLO
    BZOJ1486: [HNOI2009]最小圈
    BZOJ1098: [POI2007]办公楼biu
    BZOJ2242: [SDOI2011]计算器
    PAT A1023
    SpringCloud之整合Feign
    SpringCloud之整合Feign
    小程序在wxml页面格式化类似的2019-02-16T10:54:47.831000时间
    小程序在wxml页面格式化类似的2019-02-16T10:54:47.831000时间
    Javascript基础之-var,let和const深入解析(二)
  • 原文地址:https://www.cnblogs.com/GhostKZShadow/p/5105508.html
Copyright © 2011-2022 走看看