I'm using return EXIT_SUCCESS to exit a void function. However I get a flag that says my method should not return a value.
The code works fine, but is there a better way to exit a method by using a return or something else?
I don't think you understand how functions work. When you specify the prototype asvoid you are saying the function won't return anything. You are then contradicting the prototype by trying to return something. Change the prototype to -(int)function to return EXIT_SUCCESS. If you do not want to return something, but want to still check if it was successful you could pass in a pointer to the function: -(void)functionReturnValue:int* returnValue. Make the function set returnValue to EXIT_SUCCESS on successful completion and have the calling function check returnValue.