iOS10你掉坑了吗?

1: 系统导航栏上按键消失问题
  坑2: canOpenURL 调用返回NO问题
  坑3: iOS10 权限崩溃问题
  坑4: xib不好用了?别怕看这里!
  坑5: command +/注释失效
  坑6: 打印了一大堆0 1 的东西
1: 系统导航栏上按键消失问题

问题:升级iOS10,使用系统导航栏,发现导航栏上按钮全部消失了,无法返回上一级菜单。

原因:iOS10会重新调用原生的导航,覆盖现有的。

解决方案:在基类(BaseViewController)里面添加如下代码

- (void)viewWillDisappear:(BOOL)animated {

    if (IsDeviceVersionIOS10) {
        //相当于刷新NavigationBar
        [self.navigationController setNavigationBarHidden:YES 
    animated:NO];
        [self.navigationController setNavigationBarHidden:NO 
    animated:NO];
    }

}
坑2: canOpenURL 调用返回NO问题

由于iOS加入对用户隐私以及禁止扫描系统信息的控制,目前通过canOpenURL的方法来判断用户是否安装特定app,则会出现-canOpenURL: failed for URL: "ABC://app/*******/" - error: "This app is not allowed to query for scheme ABC"的错误,

修改起来很简单,只需要在plist中加入ABC的白名单即可,如:

<key>LSApplicationQueriesSchemes</key>

<array>

<string>ABC</string>

</array>

注意:1.这里需要添加白名单的是APP B(检测端),而不是被检测的 APP A
     2.最多添加50个
坑3: iOS10 权限崩溃问题

This app has crashed because it attempted to access 
privacy-sensitive data without a usage description.  The 
app's Info.plist must contain an NSContactsUsageDescription key with 
a string value explaining to the user how the app uses this data.

意思是说:你需要在info.plist文件 添加一个" NSContactsUsageDescription "
的Key,Value添加一个描述。

相机权限描述:

    <key>NSCameraUsageDescription</key>
    <string>cameraDesciption</string>

通信录:
    <key>NSContactsUsageDescription</key>
    <string>contactsDesciption</string>

麦克风:
    <key>NSMicrophoneUsageDescription</key>
    <string>microphoneDesciption</string>

相机:
    <key>NSPhotoLibraryUsageDescription</key>
    <string>photoLibraryDesciption</string>

备注:Key 一定不能错,Value 貌似可以随便填写

20160614172110952.jpg
坑4: xib不好用了?别怕看这里!
升级到Xcode7之后,发现Xib点击会弹出一个提示,不然无法修改里面内容,那么就选择Choose Device。重新update frame,就可以修改了,修改之后记得选择回去,不然打包会报错,如下图

图1 点击xib出现


屏幕快照 2016-09-20 上午11.56.23.png

图2 修改后打包报错


屏幕快照 2016-09-20 上午11.57.10.png

图3 解决报错问题,修改会Xcode7之前


屏幕快照 2016-09-20 下午12.19.35.png
5: command +/注释失效

很简单 ,跟大象放冰箱一样,分3步~

1.打开终端

2.输入sudo /usr/libexec/xpccachectl 

3.重启电脑
6: 打印了一大堆0 1 的东西

  2016-09-21 17:46:03.253708 HadesSDK[5866:213539] subsystem: 
  com.apple.BackBoardServices.fence, category: App, enable_level: 1, 
  persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, 
  generate_symptoms: 0, enable_oversize: 0, privacy_setting: 0, 
  enable_private_data: 0


  Produce -Scheme-Edit  Scheme

  Environment Variables 里输入Key -Value

  OS_ACTIVITY_MODE : disable

784630-221d947d657ff45f.png



文/L柠_檬(简书作者)
原文链接:http://www.jianshu.com/p/789e4d39e7b8
著作权归作者所有,转载请联系作者获得授权,并标注“简书作者”。
原文地址:https://www.cnblogs.com/wanghuaijun/p/5946292.html