IOS Objc_msgsend 32-bit and 64-bit

Source: Internet
Author: User

Objc_msgsend (Obj,normalselector,command) only supports 32-bit errors if the assignment of a class can occur in 64 bits such as:

If obj is a Cdvplugin class Normalselector is a method selector (that is, @selector (method name)) The parameter of the method is command (Cdvinvokedurlcommand Class)

The command's original attribute was successfully passed after the 32-bit execution, but the command's class changed to Cdvplugin ( actually occurred and measured on my project ) in 64 bits.

Modification Method:

Changed to: ((void (*) (Id,sel,id)) objc_msgsend) (Obj,normalselector,command);

Apple's official recommendation:

- (int) doSomething:(int) x { ... }- (void) doSomethingElse {    int (*action)(id, SEL, int) = (int (*)(id, SEL, int)) objc_msgSend;    action(self, @selector(doSomething:), 0);}

可以简写为: ((int(*)(id,SEL,int)))objc_msgSend)(self,@selector(doSomething:),0);

Pro-Test effective



IOS Objc_msgsend 32-bit and 64-bit

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.