IOS about decorating the agent with weak or assign

Source: Internet
Author: User

For this question, the code that I saw yesterday by my friend was occasionally noticed. I usually use weak to decorate, but he used the assign for a moment do not know right and wrong. and then I searched for a bit. Here's a list of results.

For weak: Indicates that the object is not responsible for keeping delegate this object, delegate the destruction of this object is externally controlled.

For strong: The object strongly references delegate, the delegate object cannot be destroyed by the outside world, resulting in a circular reference (Retain Cycles)

For assing: There is also the weak effect. But there is assign on the net is the pointer assignment, does not have the reference count operation, after the use if does not set to nil, may produce the wild pointer, but once the weak does not use, will never use, will not produce the wild pointer. The above is their own search to see the answer, who has a better argument, can evaluate the reply. Adopt quality advice.

IOS about decorating the agent with weak or assign

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.