升级Xcode7 运行项目发现报错如下:

1.Scheme白名单问题

-canOpenURL: failed for URL: “weixin://app/wxdaae92a9cfe5d54c/” - error: “This app is not allowed to query for scheme weixin”

搜索后得知

近期苹果公司iOS 9系统策略更新,限制了http协议的访问,此外应用需要在“Info.plist”中将要使用的URL Schemes列为白名单,才可正常检查其他应用是否安装。

受此影响,当你的应用在iOS 9中需要使用微信SDK的相关能力(分享、收藏、支付、登录等)时,需要在“Info.plist”里增加如下代码:

完成后需使用Xcode 7编译。

如果你在模拟器上运行可以能还会有以下报错:

-canOpenURL: failed for URL: “weixin://app/wxdaae92a9cfe5d54c/” - error: “(null)”

这是因为模拟器上并没有安装微信,如果运行到真机上就不会有报错了。

请注意:未升级到微信客户端6.2.5及以上版本的用户,在iOS 9下使用到微信相关功能时,仍可能无法成功。

下面整理一些常用的白名单

<key>LSApplicationQueriesSchemes</key><array>
    <string>mqqOpensdkSSoLogin</string>
    <string>mqzone</string>
    <string>sinaweibo</string>
    <string>alipayauth</string>
    <string>alipay</string>
    <string>safepay</string>
    <string>mqq</string>
    <string>mqqapi</string>
    <string>mqqopensdkapiV3</string>
    <string>mqqopensdkapiV2</string>
    <string>mqqapiwallet</string>
    <string>mqqwpa</string>
    <string>mqqbrowser</string>
    <string>wtloginmqq2</string>
    <string>weixin</string>
    <string>wechat</string></array>12345678910111213141516171819

qq登录绑定,qq支付,qq分享 
微信支付,微信登录绑定 
新浪登录绑定 
支付宝支付,支付宝登录绑定


2.Bitcode问题(通俗解释:在线版安卓ART模式) 
报错如下

ld: warning: directory not found for option ‘-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk/Developer/Library/Frameworks’
ld: -bundle and -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES) cannot be used together
clang: error: linker command failed with exit code 1 (use -v to see invocation) 

原因:Xcode7 及以上版本会默认开启 bitcode 。 
bitcode具体是什么就不解释了。

解决方法: 
1.更新library使包含Bitcode,否则会出现以上问题。 
2.关闭Bitcode,简单粗暴。

Build Settings”->”Enable Bitcode”改成”NO”。 

3.项目运行报错如下

<Error>: CGContextSaveGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
<Error>: CGContextTranslateCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
<Error>: CGContextRestoreGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.123

出错原因:设置app的状态栏样式的使用使用了旧的方式,在info.plist里面设置了View controller-based status bar appearance为NO,默认为YES,一般式iOS6的时候使用这种方式,iOS7,8也兼容,但是到了iOS9就报了警告。

[[UIApplication sharedApplication]setStatusBarStyle:UIStatusBarStyleLightContent];1

以前我们通过上面代码改变状态了颜色,iOS9以后点进去看api发现如下说明

// Setting the statusBarStyle does nothing if your application is using the default UIViewController-based status bar system.@property(readwrite, nonatomic) UIStatusBarStyle statusBarStyle NS_DEPRECATED_IOS(2_0, 9_0, "Use -[UIViewController preferredStatusBarStyle]");
- (void)setStatusBarStyle:(UIStatusBarStyle)statusBarStyle animated:(BOOL)animated NS_DEPRECATED_IOS(2_0, 9_0, "Use -[UIViewController preferredStatusBarStyle]");123

解决办法: 
修改方式将View controller-based status bar appearance设置为YES,然后使用新的方式来实现状态栏的样式。

- (UIStatusBarStyle)preferredStatusBarStyle;- (UIViewController *)childViewControllerForStatusBarStyle;- (void)setNeedsStatusBarAppearanceUpdate123

4 directory not found for option问题

警告如下:

ld: warning: directory not found for option ‘-F/Applications/Xcode 7.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.0.sdk/Developer/Library/Frameworks’

问题原因:Xcode7将framworks位置改变了。

解决方法: 
点击项目,选择 Targets->xxxTests 
选择build setting ,找到 Frameworks Search Path 或者 Library Search Paths 
删除$(SDKROOT)/Developer/Library/Frameworks, 
或者使用$(PLATFORM_DIR)/Developer/Library/Frameworks替换

其他问题待更新…

适配iOS9遇到的一些问题_Scheme白名单_ Bitcode及解决办法的更多相关文章

  1. UI进阶 XML解析适配 引入GDataXML文件时候 'libxml/tree.h'file not found 错误解决办法

    在工程的"Build Settings"页中找到"Header Search Path"项,添加"/usr/include/libxml2" ...

  2. IOS 应用跳转 (IOS9白名单)

    跳转到指定app的实现 IOS中应用的跳转是通过URL实现的,因此在实现应用跳转之前我们要设置一下对应的URL. 图一(寻找配置软件的URL) 图二(具体配置选项) 注意: 如果IOS版本为IOS9 ...

  3. 项目适配iOS9遇到的一些问题及解决办法 ,以及URL 白名单配置方法

    1.网络请求报错.升级Xcode 7.0发现网络访问失败.输出错误信息 The resource could not be loaded because the App Transport Secur ...

  4. iOS9适配 之 关于info.plist 第三方登录 添加URL Schemes白名单

    近期苹果公司iOS 9系统策略更新,限制了http协议的访问,此外应用需要在“Info.plist”中将要使用的URL Schemes列为白名单,才可正常检查其他应用是否安装. 受此影响,当你的应用在 ...

  5. 【转】iOS9适配 之 关于info.plist 第三方登录 添加URL Schemes白名单

    近期苹果公司iOS 9系统策略更新,限制了http协议的访问,此外应用需要在“Info.plist”中将要使用的URL Schemes列为白名单,才可正常检查其他应用是否安装. 受此影响,当你的应用在 ...

  6. iOS 适配iOS9

    1.网络接口不支持https协议,在iOS9下 在iOS9下,系统默认会拦截对http协议接口的访问,因此无法获取http协议接口的数据. 解决方案(以下方法2选1): (1)暂时退回到http协议 ...

  7. 适配IOS9中间遇到的一些问题

    1 directory not found for option问题 警告如下: ld: warning: directory not found for option ‘-F/Application ...

  8. 项目适配iOS9遇到的一些问题及解决办法

    1.网络请求报错.升级Xcode 7.0发现网络访问失败.输出错误信息 The resource could not be loaded because the App Transport Secur ...

  9. 项目适配iOS9遇到的一些问题及解决办法(更新两个小问题)

    本文转载至 http://www.bubuko.com/infodetail-1110714.html http://www.jianshu.com/p/631bd7f12a38 1.网络请求报错.升 ...

随机推荐

  1. 了解shell

    1. shell 脚本文件第一行:    #!/bin/sh 或 #!/bin/bash "#!"  又称为纪数,在执行bash脚本的时候,内核会根据它来确定该用哪个程序来解释脚本 ...

  2. 轻松学习Linux之进程监视与管理

    前后台进程转换-1 前后台进程转换-2 本文出自 "李晨光原创技术博客" 博客,谢绝转载!

  3. Html.DropDownListFor

    @Html.DropDownListFor(x => x.WillAttend, new[] { new SelectListItem() {Text = "Yes, I'll be ...

  4. MyEclipse中消除frame引起的“the file XXX can not be found.Please check the location and try again.”的错误

    读者如要转载,请标明出处和作者名,谢谢. 地址01:http://space.itpub.net/25851087 地址02:http://www.cnblogs.com/zjrodger/ 作者名: ...

  5. C++11右值引用

    [C++11右值引用] 1.什么是左值?什么是右值? 左值是表达式结束后依然存在的对象:右值是表达式结束时就不再存在的对象. 2.std::move的作用是什么? std::move用于把任意类型转化 ...

  6. Struts ForwardAction Example

    In Struts MVC model, you have to go thought the Action Controller to get a new view page. In some ca ...

  7. SD卡中的命令CMD

    SD卡中的命令是SD控制器和SD卡之间的桥梁,它封装了SD卡的实现细节,不影响SD卡中FLASH的读写变更. 命令的长度是48位,它的字段如图: SD校准定义的CMD如下:

  8. 1001.A+B Format (20)(思路,bug发现及其修改,提交记录)

    https://github.com/031502316a/object-oriented/tree/master/1001 ---恢复内容开始--- 1.解题思路 一开始见到题目时,感觉难的就是输出 ...

  9. log4.net

    1 简介 1.1Log4net的优点:     几乎所有的大型应用都会有自己的用于跟踪调试的API.因为一旦程序被部署以后,就不太可能再利用专门的调试工具了.然而一个管理员可能需要有一套强大的日志系统 ...

  10. (C++)String的用法

    (转自http://www.cnblogs.com/yxnchinahlj/archive/2011/02/12/1952550.html) 之所以抛弃char*的字符串而选用C++标准程序库中的st ...