Linked Questions
14 questions linked to/from using objc_msgSend to call a Objective C function with named arguments
15 votes
2 answers
3k views
Objective C - Weak reference to super class?
I am trying to call a method on super class inside a block. In order to avoid a retain-cycle I need a weak reference to super. How would I get a weak reference to super? [self ...
5 votes
4 answers
7k views
objective C using a string to call a method
Hi im new to objective C and was wondering if someone might be able to help me with this. I have a few different methods each requiring 3 input values and normally call it using [self methodA:1 ...
3 votes
3 answers
4k views
Creating an application on Mac OS X using C++? (without Cocoa)
It seems that in Xcode 4 there is no longer a way to create an application that is not limited to the command line using C or C++. I would like to do so, however Glut seems to be one of the only ...
8 votes
3 answers
7k views
Pure C function calling Objective-C method?
Okay, I've read half a dozen threads on this subject, but none of the solutions appear to address exact needs. Question: How does a Pure C (.c) function call a method inside a Pure Objective-C (.m) ...
1 vote
3 answers
1k views
Invoke selector with scalar argument
I currently use objc_msgSend to invoke such selector on collection of object. Is there any better way to do that? Here is my code: @protocol ADelegateProtocol { -(void) timeToEventOneDidChange:(...
4 votes
1 answer
989 views
objc_msgSend and unions
I have a problem related to objc_msgSend runtime call, when I have method which returns some union. I'm calling objc_msgSend function via libffi, and if I have union which is smaller than 16B ...
1 vote
1 answer
941 views
Is it safe to use objc_msgSend in the follow situation?
I have an object and a selector to invoke on said object. The selector will take one of 4 forms (modelled to be similar to the target-action pattern): -(void)selectorWithZeroArguments; -(void)...
1 vote
1 answer
522 views
Objective C: Two implicit parameters passed to every method called by an object
What are the two implicit parameters passed to every method by an object in Objective-c? Is it _cmd and id?
1 vote
1 answer
1k views
using native objective-c method for C callbacks
I want to callback an objective c method from c. //c int gameEngineCallback(int buttontype,void (*callback)(void)) //using above function gameEngineCallback(roundButton,callback); //this works ...
0 votes
3 answers
285 views
Calling Objective-C method from C code
I'm trying to call a method implemented in Obj-C from C code as follows: // MainViewController.m - (void)Test { [self outputLine:@"Called from MyCode.c"]; } . . . cFunc(id param); . . . // ...
0 votes
2 answers
530 views
iOS Objective-C - Call Class Method On Class Dynamically Created With NSClassFromString
I know that I can call a class method like [MyClass myMethod]; by doing [NSClassFromString(@"MyClass") performSelector:@selector(myMethod)]; I'm currently trying to do this however: [MyClass ...
0 votes
1 answer
261 views
Objective-C swizzled method not receiving arguments
I'm developing an app that needs to perform some swizzling. I'm swizzling a method -(void)m1:(CMAcceleration)a; with another one that I provide. -(void)newM(id self, SEL _cmd, ...){ va_list args; ...
-2 votes
3 answers
123 views
How can I perform "SEL fun"
if SEL fun is a parameter how can I go this fun? for example -(id)init:(SEL)fun { [target fun]; }
0 votes
1 answer
177 views
When I use objc_msgSend in runtime, why?
This works fine return [[DJLocalizationSystem shared] localizedStringForKey:(key) value: @"" table: nil bundle:bundle]; However, this does not work return objc_msgSend([DJLocalizationSystem shared], ...