Resolution of the crash problem caused by 3DTouch when using Uiimagepickercontroller-standby

Source: Internet
Author: User
Tags try catch

First, the scene of crash

When Uiimagepickercontroller is used in the program, if you run the app on iphone6s, the program crash when you forcetouch a picture with the following crash message:

* Terminating app due to uncaught exception ' nsinvalidargumentexception ', Reason: ' +[nsobject previewingcontext: Viewcontrollerforlocation:]: Unrecognized selector sent to class 0x19f678020 '

The reason for this crash is probably a bug in Apple's own SDK, which we can learn about on the Apple website. https://forums.developer.apple.com/thread/21932 because as long as the controller is using a Uiimagepickercontroller, When we forcetouch the view that chooses the picture, we will crash.

Second, the problem of the solution

We can download this tool class from http://download.csdn.net/detail/smiling8866/9367050, and then in-(BOOL) Application: (UIApplication ) Application didfinishlaunchingwithoptions: (nsdictionary ) The Msdpreventimagepickercrashon3dtouch () method is called in the Launchoptions method to resolve the above crash.

Third, the matters needing attention
    1. When introducing the above tool class in the program, Ken can compile the arm64 error, most likely the suffix name of the tool file is incorrect. Because the code in the tool class is mostly C + +, the suffix name should be changed to. mm;
    2. At compile time, be sure to remove all breakpoints in the program, otherwise the code will always be stuck in the code of the try catch that section of exception handling.
    3. Note that the 3DTouch feature is only supported in iphone6s and later versions, and Xcode uses 7.0 and later versions, so the use of the lower version of Xcode is compiled and meaningless.

Resolution of the crash problem caused by 3DTouch when using Uiimagepickercontroller-standby

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.