Home > DeveloperSection > Forums > Calling objective-c method from custom C function
Ankita Pandey
Ankita Pandey

Total Post:183

Points:1285
Posted on    December-17-2015 11:23 PM

 iPhone iPhone  Ios  Objective C 
Ratings:


 1 Reply(s)
 254  View(s)
Rate this:

I have created an app using MVC like architecture in our GUI app. Model class has some C functions. In C funtions class having some methods of Obj-C class, now I calling those methods using an object of that class.

when I call those methods it will not be executed and also I am not getting any errors.

So my problem is that I am not figure out what exactly is happening.
Is anyone have ideas, to what might be the reason for this?



Ankita Pandey
Ankita Pandey

Total Post:183

Points:1285
Posted on    December-18-2015 11:02 PM

The question I have asked, I found a solution to run objective-c method through C functions. If anyone have its better solution then please tell me:
Here is my solution:

void * refToSelf;
int callBack()
{
  [refToSelf customMethod:customArg];
}


@implementation CustomClass
-(id) init
{
  self = [super init];
  refToSelf = self;
}
-(void) customMethod:(int)customArg
{
}


Modified On Dec-19-2015 01:25:47 AM

Don't want to miss updates? Please click the below button!

Follow MindStick