Linking

Capturing Life & Tech

  • 主页
  • 随笔
  • 关于我
所有文章 外链

Linking

Capturing Life & Tech

  • 主页
  • 随笔
  • 关于我

iOS开发的系统兼容性问题解决

阅读数:次 2017-06-01
字数统计: 193字   |   阅读时长≈ 1分

1:系统方法过时的注解

1
2
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo NS_DEPRECATED_IOS(2_0, 3_0);
# 说明方法在2.0时代引入,3.0时代过时

2:系统不同版本方法的兼容性解决方案1 (最佳,不产生警告)

1
2
3
4
5
6
7
8
#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_5_0
if([picker respondsToSelector:@selector(dismissModalViewControllerAnimated:)]){
[picker dismissModalViewControllerAnimated:YES completion:nil];
}
#else{
[picker dismissViewControllerAnimated:YES completion:nil];
}
#endif

3:系统不同版本方法的兼容性解决方案2:(书写方便,但是会产生警告)

1
2
3
4
5
if([picker respondsToSelector:@selector(imagePickerController:didFinishPickingMediaWithInfo:)]){
[picker dismissViewControllerAnimated:YES completion:nil];
}else{
[picker dismissModalViewControllerAnimated:YES];
}

4: 获取系统版本号进行判断 (书写方便,但是会产生警告)

1
2
3
4
5
6
7
if ([[[UIDevice currentDevice]systemVersion] floatValue] >= 9) {
if (!self.centralManager.isScanning) {
[self.centralManager scanForPeripheralsWithServices:nil options:nil];
}
} else {
[self.centralManager scanForPeripheralsWithServices:nil options:nil];
}
  • 本文作者: Linking
  • 本文链接: https://linking.fun/2017/06/01/iOS开发的系统兼容性问题解决的副本/
  • 版权声明: 版权所有,转载请注明出处!
  • 兼容性
  • iOS

扫一扫,分享到微信

iOS中bundle的使用
iOS绘图
  1. 1. 1:系统方法过时的注解
  • 2:系统不同版本方法的兼容性解决方案1 (最佳,不产生警告)
  • 3:系统不同版本方法的兼容性解决方案2:(书写方便,但是会产生警告)
  • 4: 获取系统版本号进行判断 (书写方便,但是会产生警告)
  • © 2015-2026 Linking
    GitHub:hexo-theme-yilia-plus by Litten
    本站总访问量次 | 本站访客数人
    • 所有文章
    • 外链

    tag:

    • weather
    • 需求
    • essay
    • basketball
    • olympic
    • nginx
    • APPScan
    • SQl盲注
    • xss
    • Ajax
    • ajax
    • ai
    • agent
    • openclaw
    • ccf
    • Nginx
    • HTML5
    • html5
    • hmtl5
    • sse
    • JavaScriptCore
    • Oracle
    • operation
    • Linux
    • deploy
    • Mac Office
    • markdown
    • ListView
    • GridView
    • MySQL
    • 慢查询
    • mongodb
    • 转置
    • thought
    • network
    • ubuntu
    • NetworkManager
    • RFKill
    • Netplan
    • avatar
    • cocoa
    • blog
    • Gitalk
    • container
    • macvlan
    • docker
    • oracle
    • cookie
    • patch
    • gitea
    • git
    • iOS
    • https
    • 多线程
    • bundle
    • 兼容性
    • HTTP
    • 绘图
    • cs
    • java
    • 效率
    • 快捷键
    • route
    • nodejs
    • pip
    • arcgis
    • arcgis 建模
    • 标识
    • redis
    • read
    • bookList
    • running
    • showdoc
    • disk
    • unit-test
    • D.Wade
    • thoughts
    • duoduo
    • Python
    • python
    • tomcat
    • 读书节
    • session
    • jdk
    • war
    • 加班
    • Android onclick事件监听
    • 正则
    • 手机品牌匹配
    • ntp
    • OpenLayers
    • Geoserver
    • wechat
    • 微信公众号
    • 爬虫
    • WeChat
    • 张靓颖
    • 动漫
    • vpn
    • PPT
    • MarkDown
    • plan
    • 朱赟
    • 极客时间专栏
    • 极客邦
    • 模块化
    • MVC
    • excel
    • NBA
    • kobe
    • team
    • crawler
    • 进度条
    • ssl
    • book
    • anti-stealing-link
    • Agentic Engineering
    • Vibe Coding
    • Software 3.0
    • Andrej Karpathy
    • LLM
    • Programming

      缺失模块。
      1、请确保node版本大于6.2
      2、在博客根目录(注意不是yilia-plus根目录)执行以下命令:
      npm i hexo-generator-json-content --save

      3、在根目录_config.yml里添加配置:

        jsonContent:
          meta: false
          pages: false
          posts:
            title: true
            date: true
            path: true
            text: false
            raw: false
            content: false
            slug: false
            updated: false
            comments: false
            link: false
            permalink: false
            excerpt: false
            categories: false
            tags: true
      

    • GitHub Trending
    • OpenAI ChatGPT
    • Gitee码云
    • 简书
    • CSDN