IOS10 adaptation, XCODE8 configuration summary

Source: Internet
Author: User

With the advent of iOS10 push updates, industrious programmers are working overtime to move bricks, for this collection of some iOS10 updated skills for everyone reference, constantly updated like star


Frontier One, Xcode8 plugin where did you go?

I thought it was the same as before. Xcode upgrade, only need to update the dvtplugincompatibilityuuid in Xcode info.plsit, the results found a bit of wood with tears run; Apple solves Xcode ghost, blocks the plugin, This has also found the relevant solutions, but it is not recommended to do so, because it is annoying to not be able to upload iTunes content https://github.com/inket/update_xcode_plugins
Another option is Xcode's own comment plugin!

Workaround

Open terminal, command run: sudo/usr/libexec/xpccachectl
Then you have to restart the computer to take effect

Note: The Xcode8 has a built-in annotation feature, where

Shortcut keys: Option + Common +/


01.png. Privacy rights and related settings

Note that Info.plist does not add the corresponding field, access to the album, Address book, while adding, the end of the tail does not have spaces

Warning:

Recently there are small partners to use Xcode 8 package upload app, local authentication and IPA upload are normal. However, the build version of itunes Connect backstage has not come out, the mobile app side itunes Connect received the push notification prompt "Your app has changed to invalid binary" and Apple sent your account email "Th Is app attempts to access privacy-sensitive data without a usage description. The app ' s info.plist must contain an nscamerausagedescription key with a string value explaining to the user how the app u SES this data. "

IOS 10 has asked us to add a description of the permission request, such as when you debug your contacts and albums, and you can see that the program crashes when you request the appropriate permissions. Plus a permission description, but if the description string is empty, debugging works fine, but it raises the problem that the package above is invalid. "All still need a specific descriptive information".

Tips: You develop a small partner can install a mobile phone-side itunes Connect, to facilitate timely receipt of relevant audit progress, while the mailbox set up the development of the mailbox, in time to receive Apple email to developers

We need to open the Info.plist file to add a description of the appropriate permissions, or the program will crash on IOS10. Your project access to private data, such as: Cameras, albums, contacts, etc., in the Xcode8 to open the compilation, all will be crash, the console will output the following such a log:
Specific as

    • Log print error prompt

022.png
    • Permissions Configuration Info.plist File

02.png
    • Microphone Permissions: Privacy-microphone usage Description Do you want to allow this app to use your microphone?
    • Camera permissions: Privacy-camera usage Description Do you want to allow this app to use your camera?
    • Album Permissions: Privacy-photo library Usage Description Do you want to allow this app to access your media library? Address Book permissions: privacy-contacts Usage Description Do you want to allow this app to access your contacts?
    • Bluetooth permissions: Privacy-bluetooth Peripheral usage Description Do you Xu Yun this app to use Bluetooth?
    • Voice to text permissions: Privacy-speech recognition usage Description allow this app to use speech recognition?
    • Calendar permissions: Privacy-calendars usage Description Do you want to allow this app to use the calendar?
    • Location permissions: Privacy-location when on use Usage Description we need to get relevant data about you from your location
    • Location rights: Privacy-location always Usage Description We need to get data about you from your location
      The positioning needs to be written so as to prevent the shelves from being rejected.

Select the current target in Xcode, select capabilities, find background Modes, open it, select the corresponding permission in the


023.png Three, xib file alarm

Xcode8 prompt after opening


03.png

Select the Choose device and then the frame will appear, just update the update frame

Note: If you follow the above steps, open xib with XCODE7 will report the error, modify the method: Right-xib file->open as Source Code, warm tip: Persuade your small partner Update Xcode8 bar, or install two Xcode,

Workaround: Need to delete xib inside

<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
Four, the font becomes larger, the original frame needs to fit

After the discovery of the original 2 words in the width of 24, now 2 words need 27 width to display.

IOS 10 to determine the system version mode update

Judging the system version is what we often use, especially now everyone may need to adapt to iOS 10, then the problem arises, such as:

We got the answer:

Value of 1
[[[[Uidevice Currentdevice] systemversion] substringtoindex:1] IntegerValue]

Value of 10.000000
[[Uidevice Currentdevice] Systemversion].floatvalue,

Value of 10.0
[[Uidevice Currentdevice] systemversion]

Therefore, the best way to judge the system is to use the latter two methods, oh ~ I forgot to say [[Uidevice Currentdevice] Systemversion].floatvalue This method is also not reliable, As if the output of the 8.3 version of the value is 8.2, it is not clear that is not reliable, so we recommend that you use [[Uidevice Currentdevice] systemversion] This method!

Swift judges the following:

If #available (IOS 10.0, *) {
IOS 10.0
Print ("IOS 10.0");
} else {}

Vi. Xcode 8 compilation generates logs

When you create a new project with Xcode8 Direct compilation found print a lot of logs, the solution is to set

Os_activity_mode:disable

Such as:


Print Log.png
04.png

Note: Add or print a lot of log, please check the blue "tick" and then check again

If we want to know when the program starts, you can add the environment variable Dyld_print_statistics in the project scheme. During debugging, you can print out the time spent in each stage of the program's startup process in the console.


[Email protected] seven, push

One of the highlights of the iOS10 update here is the push, which makes it incredibly powerful.


05.pngiOS 9 Previous notification
    • When calling a method, some methods make it difficult to distinguish and write wrong methods, which makes developers sometimes very distressed.
    • The path that the app captures notifications at run time and non-runtime is not consistent.
    • When applied to the foreground, remote notifications cannot be displayed directly, and further processing is required.
    • Notifications that have been issued cannot be updated, the content is not changed when it is issued, and only simple text presentation, extensibility is not very good at all.
New features for IOS 10
    • All relevant notifications are consolidated into the Usernotifications.framework framework.
    • Added undo, update, and mid-way notifications can be modified.
    • Notification is not a simple text, you can add videos, pictures, custom notification display and so on.
    • IOS 10 is easier to manage than previous notifications and has been optimized for large scale, a good thing for developers.
    • IOS 10 has been optimized for permissions issues, and it's easier to request permissions (local and remote notifications are integrated in one method).
    • When running in the app to be notified, the system comes with pop-up popup!
    • Send text encryption push, push information more secure and reliable

IOS10 received notification is no longer in [application:didreceiveremotenotification:]

method to deal with, IOS10 launches new proxy method, receives and processes various notifications (local or remote)

-(void)  usernotificationcenter: (Unusernotificationcenter *) Center Willpresentnotification: (unnotification *) notification Withcompletionhandler: (void (^) ( unnotificationpresentationoptions)) Completionhandler {//app receives notification in foreground nslog (@ "========%@", notification);} -(void)  Usernotificationcenter: (Unusernotificationcenter *) Center Didreceivenotificationresponse: (unnotificationresponse *) response Withcompletionhandler: (void (^) ()) Completionhandler {//Click notification to enter app nslog (@ "response:%@", Response)}                
Follow-up will be constantly updated, there is a source of local trouble partners point out, thank you!

IOS10 adaptation, XCODE8 configuration summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.