ios 10 adaptation

1. Certificate Management

 

After opening the project with Xcode8, the following picture is more obvious. This is a new feature of Apple that can help us manage certificates automatically. It is recommended that you check this Automatically manage signing (Ps. But when I used the beat2 version, it was completely impossible. The GM version was amazing and good.)

 

 

Here's my list of possible problems:

 

1. A screenshot of Xcode without setting up a developer account

 

 

The solution is: you can add an Apple account in the preferences of Xcode.

 

2. Screenshots when the device machine is not added to the developer's Device

 

 

The solution is: after you add the device to the development machine on the official website, you can accompany the description file and re-create the next description file.

 

3. Normal situation: Xcode configures the picture after logging in to the developer account, just wait patiently.

 

 

Picture after waiting

 

 

2. Notes on Xib files

 

After opening the xib file with Xcode8, the prompt shown below will appear.

 

 

You can choose Choose Device.


After that, you will find that the layout is messed up, and you only need to update the frame. As shown below

 

 

  • Note: If you follow the above steps, an error will be reported when you open Xib with Xcode7,

     

 

  • Solution: need to delete Xib inside

     

    <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>

     

    This sentence, and change the toolsVersion in < document > and the version in < plugIn > to the value in your normal xib file, but it is not recommended to do so. After Xcode8 comes out, I hope everyone can get started quickly and update all staff. . This is the same as Xcode5 to Xcode6, there are changes, but you still have to learn and adapt as soon as possible!

 

Three, code and Api attention

 

After using Xcode8, some code may not compile, and I will talk about the problems I encountered.


1. The proxy method of UIWebView:
**Note to delete the nullable in front of NSError, otherwise an error will be reported.

 

- (void)webView:(UIWebView *)webView didFailLoadWithError:(nullable NSError *)error
{
    [self hideHud];
}

 

四、代码注释不能用的解决办法

 

这个是因为苹果解决xcode ghost,把插件屏蔽了。


解决方法


打开终端,命令运行:  sudo /usr/libexec/xpccachectl
然后必须重启电脑后生效

注意:Xcode8内置了开启注释的功能,位置在这里

 

 

快捷键的设置在这里

 

 

貌似Xcode8取消了三方插件的功能,具体可以查阅下Xcode8 Source Editor

五、权限以及相关设置

 

注意,添加的时候,末尾不要有空格


我们需要打开info.plist文件添加相应权限的说明,否则程序在iOS10上会出现崩溃。


具体如下图:

 

 

  • 麦克风权限:Privacy - Microphone Usage Description 是否允许此App使用你的麦克风?

  • 相机权限: Privacy - Camera Usage Description 是否允许此App使用你的相机?

  • 相册权限: Privacy - Photo Library Usage Description 是否允许此App访问你的媒体资料库?

  • 通讯录权限: Privacy - Contacts Usage Description 是否允许此App访问你的通讯录?

  • 蓝牙权限:Privacy - Bluetooth Peripheral Usage Description 是否许允此App使用蓝牙?

  • 语音转文字权限:Privacy - Speech Recognition Usage Description 是否允许此App使用语音识别?

  • 日历权限:Privacy - Calendars Usage Description 是否允许此App使用日历?

  • 定位权限:Privacy - Location When In Use Usage Description 我们需要通过您的地理位置信息获取您周边的相关数据

  • 定位权限: Privacy - Location Always Usage Description 我们需要通过您的地理位置信息获取您周边的相关数据。定位的需要这么写,防止上架被拒。

 

六、字体变大,原有frame需要适配

 

经朋友提醒,发现程序内原来2个字的宽度是24,现在2个字需要27的宽度来显示了。


希望有解决办法的朋友,评论分享一下,谢谢啦

 

七、推送

 

如下图的部分,不要忘记打开。所有的推送平台,要想收到推送,这个是必须打开的哟✌️

 

 

之后就应该可以收到推送了。

 

PS.苹果这次对推送做了很大的变化,希望大家多查阅查阅,处理推送的代理方法也变化了。

 

// 推送的代理[<UNUserNotificationCenterDelegate>]

 

iOS10收到通知不再是在[application: didReceiveRemoteNotification:]方法去处理, iOS10推出新的代理方法,接收和处理各类通知(本地或者远程)

 

- (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler { //应用在前台收到通知 NSLog(@"========%@", notification);}- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)())completionHandler { //点击通知进入应用 NSLog(@"response:%@", response);}

 

八、屏蔽杂乱无章的bug

 

更新Xcode8之后,新建立工程,都会打印一堆莫名其妙看不懂的Log。如这些

 

subsystem: 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,

 

屏蔽的方法如下:


Xcode8里边 Edit Scheme-> Run -> Arguments, 在Environment Variables里边添加OS_ACTIVITY_MODE = Disable

 

 

如果写了之后还是打印log,请重新勾选对勾,就可以解决了

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326525141&siteId=291194637