搜集到一些升级到XCode 8 的问题

 Xcode8问题汇总

【1】、Xcode8代码出现ubsystem: com.apple.UIKit, category: HIDEventFiltered, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setting: 2, enable_private_data: 0 2016-09-14 17:18:55.843428 MyApp[6880:340837]

解决办法:【product】-【scheme】-【Edit Scheme】-【Run】-【Argument】-【Environment Variable】添加keyValue【OS_ACTIVITY_MODE   disable】可以停止输出打印此日志

遗留问题还会出现Class PLBuildVersion is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/AssetsLibraryServices.framework/AssetsLibraryServices (0x10a39a910) and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/PhotoLibraryServices.framework/PhotoLibraryServices (0x10a1c4210). One of the two will be used. Which one is undefined.

【2】MJRefresh出现崩溃现象

 解决办法:类库增加判断

1
2
3
if  (range.location !=  NSNotFound ) {
             language = [language substringToIndex:range.location];
}    

【3】iOS10字体隐藏问题

label的话写一个扩展类

1
2
3
4
5
6
7
8
9
10
11
12
13
14
@implementation  UILabel (Extend)
 
- ( void )lableAdaptIOS10{
 
     CGFloat iOS10 = [[UIDevice currentDevice] systemVersion].floatValue >= 10;
     if  (iOS10) {
//        self    UIFont 的preferredFontForTextStyle: 意思是指定一个样式,并让字体大小符合用户设定的字体大小。
         [ self  sizeToFit];
 
//      self.font =[UIFont preferredFontForTextStyle: UIFontTextStyleHeadline];  
         //是否更新字体的变化
//        self.adjustsFontForContentSizeCategory = YES;
     }
}

 [4] StroyBoard问题

<1>Xcode 打开SB频繁出现崩溃现象

<2>Xcode 打开SB后 约束出现大量警告⚠️

【5】Xcode8注释失效

打开终端,命令运行: sudo /usr/libexec/xpccachectl 重启电脑

 [6] Xcode7 8兼容问题

This version does not support documents saved in the Xcode 8 format. Open this document with Xcode 8.0 or later.

删除SB中代码:

【7】Xcode8不能真机打印log问题

1
2
3
4
5
6
7
#ifdef DEBUG
#define HYString [NSString stringWithFormat:@"%s", __FILE__].lastPathComponent
#define HYLog(...) printf("%s 第%d行: %s\n\n", [HYString UTF8String] ,__LINE__, [[NSString stringWithFormat:__VA_ARGS__] UTF8String]);
 
#else
#define HYLog(...)
#endif

 【8】Xcode SVN 更新 报错 The server certificate failed to verify.

   解决办法:1、svn ls xxxxxx(SVN地址)

        2、期间可能需要输入SVN用户名和密码,然后p即可

 【9】iOS10 隐私权限问题(不加可能导致崩溃) 

1
2
3
4
5
6
7
8
     <key> NSCameraUsageDescription </key>
<string>亲,我们要打开你的相机!</string>
<key> NSContactsUsageDescription </key>
<string>亲,我们要打开你的通信录!</string>
<key> NSLocationAlwaysUsageDescription </key>
<string>为方便使用地图功能,请您允许定位!</string>
<key> NSPhotoLibraryUsageDescription </key>
<string>亲,我们要打开你的相册!</string>        

 【10】iOS10 消息推送(推送有提醒,消息收不到) 

解决办法:更新三方sdk吧,都有方案

iOS10 Xcode8 【以极光举例  其他都差不多】 设置: 

 

 

iOS10新增framework:

iOS10新增接收通知方法:

1
2
3
4
- ( void )jpushNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:( void  (^)( NSInteger ))completionHandler {
     NSDictionary  * userInfo = notification.request.content.userInfo;
 
- ( void )jpushNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:( void  (^)())completionHandler {

 iOS7 < iOS系统< iOS 10通知接收方法

1
- ( void )application:(UIApplication *)application didReceiveRemoteNotification:( NSDictionary  *)userInfo fetchCompletionHandler:( void  (^)(UIBackgroundFetchResult))completionHandler {

 iOS6以及之前接收通知方法

1
2
- ( void )application:(UIApplication *)application didReceiveRemoteNotification:
( NSDictionary  *)userInfo {

 

【11】Xcode8 真机运行错误

Development cannot be enabled while your device is locked.Please unlock your device and reattach.(0xE80000E2

重新退出Xcode,再真机运行即可!

[12]macOS Sierra 系统下上传包错误

Xcode7.3.1打包 macOS Sierra 系统下 使用application loader上传包 出现错误 ERROR ITMS - 90167 No. app bundles found in the package

解决办法:使用其他版本的系统(例如10.11.6之前版本)。

2 预备工作 2.1 创建iOS工程 在XCode中建立你的工程,或者打开已经建立的工程。 2.2 添加静态库 将开发工具包中lib目录下的iflyMSC.framework添加到新建工程中(如下图所示)。 提交 图一 图二 提交 图三 2.3 添加framework 按下图添加SDK所需要的iOS库,请注意libz.dylib,CoreTelephoney.framework不要遗漏。 提交 图四 注:如果使用的是离线识别,还需要增加libc++.dylib。 2.4 确认SDK的路径 提交 图五 请确认上图红色部分的路径能够找到iflyMSC.framework。为了支持多人开发,建议双击红色部分,把路径改为相对路径,例如像下图所示。 提交 图六 注意:请把不必要的路径删除。例如更新了SDK后,新的SDK与旧的SDK不在同一路径,请把旧的路径删除,避免引用到旧的库。对应集成SDK后发现编译失败,提示找不到头文件,请先检查这个路径是否正确。 2.5 导入头文件 在你需要使用MSC服务的文件中导入相应的头文件 例如: C/C++ Code //带界面的语音识别控件 #import “iflyMSC/IFlyRecognizerViewDelegate.h” #import “iflyMSC/IFlyRecognizerView.h” C/C++ Code //不带界面的语音识别控件 #import “iflyMSC/IFlySpeechRecognizerDelegate.h” #import “iflyMSC/IFlySpeechRecognizer.h” C/C++ Code //不带界面的语音合成控件 #import “iflyMSC/IFlySpeechSynthesizerDelegate.h” #import “iflyMSC/IFlySpeechSynthesizer.h” 2.6 集成帮助文档到Xcode 打开终端(termainl或iterm),cd 到压缩包的doc 目录,执行以下命令: 注:不同的xcode版本,对应的docset路径可能有变化,需要根据实际路径来操作。 C/C++ Code cp -R -f -a com.iflytek.documentation.IFlyMSC.docset ~/Library/Developer/Shared/Documentation/DocSets/ 然后执行命令 C/C++ Code open ~/Library/Developer/Shared/Documentation/DocSets/ 请核对文档的版本为最新下载的版本 提交 图七 打开Xcode的帮助文档就可以看到已经集成的文档 提交 图八 2.7 初始化 必须在初始化后才可以使用语音服务,初始化是异步过程,推荐在程序入口处调用。 Appid是应用的身份信息,具有唯一性,初始化时必须要传入Appid。可以从demo的Definition.h APPID_VALUE中查看此信息。Demo和SDK申请地址:http://xfyun.cn C/C++ Code //将“12345678”替换成您申请的APPID。 NSString *initString = [[NSString alloc] initWithFormat:@"appid=%@",@” 12345678”]; [IFlySpeechUtility createUtility:initString]; 3 语音听写 使用示例如下: C/C++ Code //头文件定义 //需要实现IFlyRecognizerViewDelegate,为识别会话的服务代理 @interface RecognizerViewController : UIViewController<IFlyRecognizerViewDelegate> { IFlyRecognizerView *_iflyRecognizerView; } //初始化语音识别控件 _iflyRecognizerView = [[IFlyRecognizerView alloc] initWithCenter:self.view.center]; _iflyRecognizerView.delegate = self; [_iflyRecognizerView setParameter: @"iat" forKey: [IFlySpeechConstant IFLY_DOMAIN]]; //asr_audio_path保存录音文件名,如不再需要,设置value为nil表示取消,默认目录是documents [_iflyRecognizerView setParameter:@"asrview.pcm " forKey:[IFlySpeechConstant ASR_AUDIO_PATH]]; //启动识别服务 [_iflyRecognizerView start]; /*识别结果返回代理 @param resultArray 识别结果 @ param isLast 表示是否最后一次结果 */ - (void)onResult: (NSArray *)resultArray isLast:(BOOL) isLast { } /*识别会话错误返回代理 @ param error 错误码 */ - (void)onError: (IFlySpeechError *) error { } 4 语音识别 4.1 在线语音识别 上传联系人,使用示例如下: C/C++ Code //创建上传对象 _uploader = [[IFlyDataUploader alloc] init]; //获取联系人集合 IFlyContact *iFlyContact = [[IFlyContact alloc] init]; NSString *contactList = [iFlyContact contact]; //设置参数 [_uploader setParameter:@"uup" forKey:@"subject"]; [_uploader setParameter:@"contact" forKey:@"dtt"]; //启动上传 [_uploader uploadDataWithCompletionHandler:^(NSString * grammerID, IFlySpeechError *error) { //接受返回的grammerID和error [self onUploadFinished:grammerID error:error]; }name:@"contact" data: contactList]; 上传用户词表,使用示例如下: C/C++ Code //创建上传对象 _uploader = [[IFlyDataUploader alloc] init]; //生成用户词表对象 //用户词表 #define USERWORDS @"{\"userword\":[{\"name\":\"iflytek\",\"words\":[\"德国盐猪手\",\"1912酒吧街\",\"清蒸鲈鱼\",\"挪威三文鱼\",\"黄埔军校\",\"横沙牌坊\",\"科大讯飞\"]}]}" IFlyUserWords *iFlyUserWords = [[IFlyUserWords alloc] initWithJson:USERWORDS ]; #define NAME @"userwords" //设置参数 [_uploader setParameter:@"iat" forKey:@"sub"]; [_uploader setParameter:@"userword" forKey:@"dtt"]; //上传词表 [_uploader uploadDataWithCompletionHandler:^(NSString * grammerID, IFlySpeechError *error) { //接受返回的grammerID和error [self onUploadFinished:grammerID error:error]; } name:NAME data:[iFlyUserWords toString]]; abnf语法上传,示例如下: C/C++ Code // ABNF语法示例,可以说”北京到上海” #define ABNFPARAM @”sub=asr,dtt=abnf” #define ABNFDATA = “#ABNF 1.0 gb2312; language zh-CN; mode voice; root $main; $main = $place1 到$place2 ; $place1 = 北京 | 武汉 | 南京 | 天津 | 天京 | 东京; $place2 = 上海 | 合肥;” //创建上传对象 _uploader = [[IFlyDataUploader alloc] init]; //设置参数 [_uploader setParameter:@"asr" forKey:@"sub"]; [_uploader setParameter:@"abnf" forKey:@"dtt"]; //上传abnf语法 [_uploader uploadDataWithCompletionHandler:^(NSString * grammerID, IFlySpeechError *error) { //接受返回的grammerID和error [self setGrammerId:grammerID]; }name:ABNFNAME data:ABNFDATA]; 4.2 本线语音识别 1) 创建识别对象(注:如果使用的是离线识别,还需要增加libc++.dylib) C/C++ Code //此方法为demo中封装,具体实现请参照demo。 self.iFlySpeechRecognizer = [RecognizerFactory CreateRecognizer:self Domain:@"asr"]; 2)设置参数 C/C++ Code //开启候选结果 [_iflySpeechRecognizer setParameter:@"1" forKey:@"asr_wbest"]; //设置引擎类型,clound或者local [_iflySpeechRecognizer setParameter:@”local” forKey:[IFlySpeechConstant ENGINE_TYPE]]; //设置字符编码为utf-8 [_iflySpeechRecognizer setParameter:@"utf-8" forKey:[IFlySpeechConstant TEXT_ENCODING]]; //语法类型,本地是bnf,在线识别是abnf [_iflySpeechRecognizer setParameter:@”bnf” forKey:[IFlyResourceUtil GRAMMARTYPE]]; //启动asr识别引擎 [[IFlySpeechUtility getUtility] setParameter:@"asr" forKey:[IFlyResourceUtil ENGINE_START]]; //设置服务类型为asr识别 [_iflySpeechRecognizer setParameter:@"asr" forKey:[IFlySpeechConstant IFLY_DOMAIN]]; //设置语法构建路径,该路径为sandbox下的目录,请确保目录存在 [_iflySpeechRecognizer setParameter:_grammBuildPath forKey:[IFlyResourceUtil GRM_BUILD_PATH]]; //设置引擎资源文件路径,如demo中的aitalkResource中的common.mp3 [_iflySpeechRecognizer setParameter:_aitalkResourcePath forKey:[IFlyResourceUtil ASR_RES_PATH]]; 3)编译语法文本
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值