Lots functions of my program are in C file, and C has a head file therefore Objective-C files could use the functions in C, but some of the functions is use for fetch the information from the internet, for instance, somebody send a instant message to the user, and one of the functions in C file could get the information, but how could this function in C file send information to Objective-C file and show the message to the user.
Therefore my question is: how to let the function in C file sending message to Objective-C.
Cheers, pls help!
Lots functions of my program are in C file, and C has a head
Share
As H2CO3 suggests, the easiest solution is to rename the
.cfiles to.mfiles and add the Objective-C.Alternatively, have your Objective-C interface expose a header file with nothing but C function declarations where the implementation of said functions — in a .m file — provides the glue to your ObjC code. (Note that this is exactly how much of CoreFoundation is implemented; the C functions are merely glue on top of an underlying ObjC implementation).