Threading issues---will crash on ipad and won't crash on iphone

Source: Internet
Author: User

The application of the scene is the use of radio button in development-----to add radio button action on TableView, that is, click to select the appropriate action, the specific interface is shown below:

It's not a problem to show on the iphone in this case, but when the app is running on the ipad, the following error occurs:

The reason for the error is that the resource that has been freed is clearly quoted, and this resource is:

Setting its Type property to a assign object will not be held, resulting in a tragedy that crashes on ipad "iOS version 9.3.5" Directly changing the Assign property to strong solves this problem----------reason:This is because assign can point to the freed memory, the decorated object is a weak reference, the reference pointer of the parameter object does not increase, so the object itself is to record the click position of different objects, when its pointer does not change the space-time pointer problem, forming a crash. copy/retain/strong/assign/weak are keywords that have an impact on memory management1.copy nsstring, block, Variable object types (nsmutablestring, Nsmutablearray, nsmutabledictionary, etc.)2.retain can be used in a MRC/ARC environment to decorate properties of an object type, and when the setter method is called, the reference pointer of the Parameter object increases by 13.strong properties used in ARC environments to decorate object types when the setter method is called, the reference pointer of the parameter object increases by 14.assign is used to decorate a property of a basic data type or object type in a MRC/ARC environment, a weak reference when a property of an object type is decorated, although a parameter object can be used, but a reference pointer to a parameter object does not increase5.weak is used in an arc environment, which modifies the object type to represent a weak reference, although a parameter object can be used, but the reference pointer of the parameter object does not increasethe difference between retain and strong: the object that the strong decorated property points to, and when the reference count (Retaincount) of the referenced object is 0 o'clock, the system automatically resets the object's corresponding pointer to nil and frees the corresponding memory space. and retain modified is not, easy to cause the wild pointer, causing unknown crashes, strong than retain security, but only in the ARC environment useAssign and weak: Using the weak property to point to the object, after the reference count of 0, the system will be the object's pointer to the nil,assign decorated properties do not do this operation, easy to cause the wild pointer, causing an unknown crash, weak can only be used in arc, and weak cannot modify the base data type

Threading issues---will crash on ipad and won't crash on iphone

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.