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新特性 

    地图
     
    友盟分享  分享到微信注意点
  • 相关阅读:
    AJAX 方式
    Qt程序设计——txt文本中获取字符串的问题
    二、Cocos2dx中Android部分的c++和java实现相互调用(高级篇)
    Android项目 手机安全卫士(代码最全,注释最详细)之五 splash动画效果
    Navigator 对象
    Dreamweaver中打开CodeSmith文件
    IOS开发:xcode5版本引发的问题
    Ubuntu 13.04 小米2S连接Eclipse真机调试
    Java面试题之四
    c++基础 之 面向对象特征一 : 继承
  • 原文地址:https://www.cnblogs.com/GhostKZShadow/p/5105508.html
Copyright © 2011-2022 走看看