NSProxy, nsproxynsobject

Source: Internet
Author: User

NSProxy, nsproxynsobject

The NSProxy class is very important in the distributed object architecture. Because of its special functions, NSProxyCocoaThe frequency of appearance in the program is very low.

 

NSProxy is an abstract class that defines a set of APIS for objects that behave like other object substitutes or do not exist. Generally, the message sent to the proxy is forwarded to a real object or load (or convert itself into) a real object. The NSProxy base class can be used to transparently forward messages or lazy initialization of costly objects. NSProxy implements the basic methods required for base classes, including the NSObject protocol, but as a virtual base class, it does not provide initialization methods. It will generate an exception when it receives any method that is not defined by itself, so an actual subclass must provide an initialization method or creation method, and reload forwardInvocation: method and methodSignatureForSelector: method to process messages that are not implemented by yourself. ForwardInvocation of a subclass: The implementation should take all measures to handle invocation, such as forwarding network messages, loading a real object, and forwarding invocation to it. MethodSignatureForSelector: To provide parameter type information for a given message, the implementation of the subclass should be able to determine the parameter type of the message to be forwarded and construct the corresponding NSMethodSignature object. For details, see the type descriptions of NSDistantObject, NSInvocation, and NSMethodSignature.

Related Article

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.