I have an Objective-C class. What I am doing is I am calling C functions in my objective-C class [ This C functions I implemented in one file , which is part in this sample ios project]. All C functions are working fine , So far no issues.
When I try to call an asynchronous function in C file , that functions will give response to objective-c class after a while. I called function pointer in C which is triggered properly in Objective-C class. Please check the following code snippet. I want to do some UI related actions on the call back method. Is that possible ? If No is there any other way ? Could you please give me respons ASAP. Thanks.
C file :
void my_int_func(int x);
void test_asyn_fun ()
{
/* This code is for Sleep logic */
for (int i=0; i<50000; i++) {
// sleep
}
/* Sleep End */
void (*foo)(int);
foo = &my_int_func;
foo(25);
}
Objective-C File:
void my_int_func(int x) // this is call back method
{
printf( "%d\n", x ); // working properly
[self anyMethodInMyClass]; // I am unable to use self in this function.
}
Actually My requirement is
I have C code which will do a Voip call functionality. I am calling C functions from my objective-C [iOS] code. If call has been disconnected by the receiver one of my C function is getting called and it stops the process. But still my UI is showing calling related UI. I want to dismiss that.
here , How do I send a notification to my objective-c class from C function to dismiss the UIView. Can any one kindly help me.
Actually i used function pointers but it's not working.