Summary of ios10 adaptation problems

Say in front

GM versions of ios10 and xcode8 have been released and downloaded, I updated it with an uneasy heart (I'm afraid there's an adaptation problem!!!), I first updated xcode8 and ran the company's project. Except for the problem in the nullable field, everything else was quite smooth. However, the project still had a small problem. Fortunately, it didn't change as much as ios9 was updated. Then I upgraded ios10 to my hand machine and ran a real machine. As a result, I accidentally tested it until 2:00 in the middle of the night... Waste I had a good time playing games all morning. This article arranges the problems I encounter one by one, hoping that monkeys with similar problems can have some reference.

Problem point

Question 1 (nullable)

Q: It used to be nullable, but now it's wrong.

A: Just delete it 😂

Question 2 (system permissions)

Q: The xcode8 compiled version will crash when accessing cameras, photo albums and other places that require users to click the permission to open

A: Because ios10 enhances security and privacy enhancements, you need to add a description when applying for many private permissions. If you don't add it, it will crash. The solution is just in info Just configure the description information of the request permission in plist.

Taking camera and photo permissions as an example, the description information can be any string, which is similar to the access location field in ios9

All keys are listed below. Add them yourself.

Question 3 (APP jump settings)

Q: Problems accessing the settings page of the current application

If you click the jump setting page in the above way, which works normally on ios7-9, you will report the following error on ios10

A: The solution is also very simple. In fact, the URL to directly jump to the setting page is provided from ios8

NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString]; It's OK to replace it with this URL. By the way, the OpenURL method is also abandoned in ios10, but it can still be used

Question 4 (calculation of text width and height caused by font change)

Q: When the xcode7 compiled package dynamically calculates the height of a text, the calculated height is not enough to accommodate this text on the ios10 device

A: Because ios10 changes the system font, the text size will be a little different from that of ios9 and previous systems. If you continue to compile with xcode7, it is recommended to increase the text height by 5.

Or you can directly use the package compiled by xcode8, and the calculation result of text height is correct.

As for libraries like yytext, the bottom layer is written in coretext. This problem will exist on xcode7 and xcode8. It is OK to directly add 5 to the final calculated height.

Question 5 (getting device token by pushing)

Q: The following error will be reported when getting the device token during push

A: Open the following settings

@H_ 301_ 115@

The following files will be generated automatically

Open as shown below

The field corresponds to two states: development and production, and then run again to successfully obtain the device token.

Question 6 (ios7 support)

Starting from xcode8, ios7 is no longer supported, and ios8 is supported at least.

However, since ios10 is out, and the number of ios7 users is really small, I think ios7 can be abandoned and the development cost can be reduced. The performance of some old libraries, such as alasset, is really bad. But I still have to listen to the arrangement of the leaders. Ha ha. Fortunately, the IPA package compiled by xcode8 can still work normally when installed on IOS 7 devices. It's just that it's a little troublesome during testing.

The above is a summary of ios10 adaptation problems introduced by Xiaobian to you, problems and solutions that can't be adapted and compiled. I hope it will be helpful to you. If you have any questions, please leave me a message, and Xiaobian will reply to you in time. Thank you very much for your support for the programming tips website!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>