Aggiungo qualche dettaglio.
Questo è la signature del metodo nativo:
JNIEXPORT void JNICALL Java_com_javastaff_jsheet_JSheetDelegate_nativeSho wSheet(JNIEnv *, jclass, jint, jobject, jobject, jobject);
Questo invece è il corpo:
codice:
JNIEXPORT void JNICALL Java_com_javastaff_jsheet_JSheetDelegate_nativeShowSheet
(JNIEnv *env, jclass caller, jint type, jobject parent, jobject listener, jobject text) {
// Never assume an AutoreleasePool is in place, unless you are on the main AppKit thread
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
JSheetDelegate *jdel;
// Take the parent component (passed via Java call) and get the parent NSWindow from it
NSWindow *parentWindow = GetWindowFromComponent(parent, env);
// It is extremely important to show the sheet from the main AppKit thread WITHOUT BLOCKING using performSelectorOnMainThread with a waitUntilDone value of NO
...
...
NSLog(@"Stringa passata = %@", text);
[pool release];
}
Da java text viene passato come String ma una volta in objective-c salta tutto, provando a stampare da errore di accesso alla memoria :|