Skip navigation.
 
mlcocoa java bridge: converting nsarray to java array
FROM : Matthew
DATE : Sat Nov 20 23:13:15 2004

Hello,

I have an issue using the Cocoa Java Bridge. It is working fine for
calling Java methods that require no arguments or string arguments, but
I'm having an issue passing an NSArray of NSString to a java method
that expects an array of java strings objects.

A method exists in a Java class that wants an array of strings like
this:

public void someMethod( String[] whatever) {//body}

From Objective C my header for this Java method is the following:

- (void)someMethod(NSArray*)whatever;

The NSArray of course is loaded with a few NSStrings. At runtime I get
this nice error:

*** Uncaught exception: <NSInvalidArgumentException>
_BRIDGEMorphObjcArgumentsForJava: can't convert argument to Java array


So the question would be, what's going on here? Is it not possible to
pass an NSArray in this way? Any ideas?

Matthew