适配IOS9中间遇到的一些问题
2015-10-13 21:33
489 查看
1 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替换
2.项目运行报错如下
出错原因:设置app的状态栏样式的使用使用了旧的方式,在info.plist里面设置了View controller-based status bar appearance为NO,默认为YES,一般式iOS6的时候使用这种方式,iOS7,8也兼容,但是到了iOS9就报了警告。
以前我们通过上面代码改变状态了颜色,iOS9以后点进去看api发现如下说明
解决办法:
修改方式将View controller-based status bar appearance设置为YES,然后使用新的方式来实现状态栏的样式。
3.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”。
4.第三方的影响
你的应用在iOS 9中需要使用微信SDK的相关能力(分享、收藏、支付、登录等)时,需要在“Info.plist”里增加如下代码:
完成后需使用Xcode 7编译。
如果你在模拟器上运行可以能还会有以下报错:
-canOpenURL: failed for URL: “weixin://app/wxdaae92a9cfe5d54c/” - error: “(null)”
这是因为模拟器上并没有安装微信,如果运行到真机上就不会有报错了。
请注意:未升级到微信客户端6.2.5及以上版本的用户,在iOS 9下使用到微信相关功能时,仍可能无法成功。
下面整理一些常用的白名单
qq登录绑定,qq支付,qq分享
微信支付,微信登录绑定
新浪登录绑定
支付宝支付,支付宝登录绑定
警告如下:
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替换
2.项目运行报错如下
<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.
出错原因:设置app的状态栏样式的使用使用了旧的方式,在info.plist里面设置了View controller-based status bar appearance为NO,默认为YES,一般式iOS6的时候使用这种方式,iOS7,8也兼容,但是到了iOS9就报了警告。
[[UIApplication sharedApplication]setStatusBarStyle:UIStatusBarStyleLightContent];
以前我们通过上面代码改变状态了颜色,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]");
解决办法:
修改方式将View controller-based status bar appearance设置为YES,然后使用新的方式来实现状态栏的样式。
- (UIStatusBarStyle)preferredStatusBarStyle; - (UIViewController *)childViewControllerForStatusBarStyle; - (void)setNeedsStatusBarAppearanceUpdate
3.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”。
4.第三方的影响
你的应用在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>
qq登录绑定,qq支付,qq分享
微信支付,微信登录绑定
新浪登录绑定
支付宝支付,支付宝登录绑定
相关文章推荐
- iOS代理设计模式
- iOS之OC随笔-类别(分类)Demo
- iOS 获得通讯录中联系人的所有属性--b
- 第 二 十 九 天 :监 控 软 件 之 nagios
- iOS 后台运行实现 --备用
- Xcode7.0.1(ios9)的部分适配问题
- iOS数据存取
- iOS多线程常用类说明--备用参考
- iOS之OC随笔-Foudation框架下集合的相互转换
- iOS 地图
- iOS 创建单例的两种方法
- iOS之OC随笔-遍历数组方法总结
- iOS之CocoaPods 安装
- IOS contentMode属性
- 蓝懿iOS 技术内容和心得 10。13
- ios学习之模糊效果的学习
- iOS序列化与反序列化
- iOS之OC随笔-属性修饰符
- iOS 常用名词
- iOS第三方库