id<MyProtocol> topLayoutGuideObj = objc_msgSend(viewController, @selector(myselector));
है एक सिंटैक्स त्रुटि फेंकता है "अत्यधिक तर्क कॉल कार्य करने के लिए, उम्मीद 0, 2", अब objc_msgSend का उपयोग कर कह तर्क की संख्या गलत
हालांकि, objc_msgSend के लिए समारोह हस्ताक्षर ऐसा लगता है:
#if !OBJC_OLD_DISPATCH_PROTOTYPES
OBJC_EXPORT void objc_msgSend(void /* id self, SEL op, ... */)
__OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0);
OBJC_EXPORT void objc_msgSendSuper(void /* struct objc_super *super, SEL op, ... */)
__OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0);
#else
/**
* Sends a message with a simple return value to an instance of a class.
*
* @param self A pointer to the instance of the class that is to receive the message.
* @param op The selector of the method that handles the message.
* @param ...
* A variable argument list containing the arguments to the method.
*
* @return The return value of the method.
*
* @note When it encounters a method call, the compiler generates a call to one of the
* functions \c objc_msgSend, \c objc_msgSend_stret, \c objc_msgSendSuper, or \c objc_msgSendSuper_stret.
* Messages sent to an object’s superclass (using the \c super keyword) are sent using \c objc_msgSendSuper;
* other messages are sent using \c objc_msgSend. Methods that have data structures as return values
* are sent using \c objc_msgSendSuper_stret and \c objc_msgSend_stret.
*/
OBJC_EXPORT id objc_msgSend(id self, SEL op, ...)
__OSX_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0);
तर्क "शून्य" या भिन्न हैं? मुझे समझ में नहीं आता कि मुझे यह कैसे कहना है।
उत्सुक क्यों आप आसानी से '[viewController mySelector] को कॉल नहीं करते हैं; '। – rmaddy
उचित सवाल। मैंने यह कोड नहीं लिखा है, मैं बस इसे ठीक करने की कोशिश कर रहा हूं - और जितना संभव हो उतना छोटा बदल सकता हूं। हालांकि, मैं केवल – nont
आईओएस 8 जीएम और एक्सकोड 6 जीएम एनडीए के तहत कर रहा हूं, ऐप्पल डेवलपर्स फोरम या ऐप्पल टेक सपोर्ट का प्रयास कर सकता हूं। –