Search code examples
iosobjective-ccodenameonenative-code

Can the arguments be named as desired when usign native code in Codename One?


I need to write native code to delete a picture from the camera library. I am completely new to Objective C so I get a bit confused by the following lines found in Codename One developper guide :

Objective-C relies on argument names as part of the message (method) signature. So -(NSString*)helloWorld: (NSString*)param isn’t the same as - (NSString*)helloWorld: (NSString*)iChangedThisName ! Don’t change argument names in the Objective-C native interface!

Does it that public boolean deleteFile(String path) in java has to be written (BOOL)deleteFile: (NSString*) param in my Objective C native code ?

Or does it mean that the parameter names in the interface file (.h) and in the implementation file (.m) have to be identical ?

Thanks a lot to anyone making it clearer in my mind ;-)!

Cheers


Solution


  • I think you have to keep your java argument's name in your Obj-C files.
    Otherwhise , it wouldn't be recognized as an implementation of NativeInterface.

    And it's simple to maintain the interface.