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

    地图
     
    友盟分享  分享到微信注意点
  • 相关阅读:
    【uiautomator】Interfaces+Exception
    【uiautomator】UiDevice
    【uiautomator】Uiautomator API
    【uiautomator】运行命令
    [www.infoshare.cc]【uiautomator】输入中文(输入法安装+测试代码)
    MFC ,List使用
    VC控件DateTimePicker使用方法
    GitHub vs. Bitbucket 不只是功能不同
    免费的私人代码托管(bitbucket) 和 常用git指令
    修改android studio中的avd sdk路径、avd sdk找不到的解决方案
  • 原文地址:https://www.cnblogs.com/GhostKZShadow/p/5105508.html
Copyright © 2011-2022 走看看