iOS: Calling native methods on iPhone
Niklas Therning
niklas at therning.org
Mon Jul 15 23:46:32 PDT 2013
Looks like a problem with blocks. presentViewController() takes a block (
(void (^)(void))completion ) but blocks are not yet supported by the RoboVM
Objective-C bridge. If possible please try showing your view controller
using a method which doesn't take a block.
On Mon, Jul 15, 2013 at 11:26 PM, Tobias Bley <tobi at ultramixer.com> wrote:
> Hi Niklas,
>
> do you have an idea how to fix the problem?
>
>
>
> Anfang der weitergeleiteten Nachricht:
>
> *Von: *Tobias Bley <tobi at ultramixer.com>
> *Betreff: **Aw: iOS: Calling native methods on iPhone*
> *Datum: *8. Juli 2013 09:57:16 MESZ
> *An: *Niklas Therning <niklas at therning.org>
>
> Hi Niklas,
>
> I tried it but it fails with the following exception:
>
> controller = <GlassViewController: 0x33a4c30>
> Exception in thread "JavaFX Application Thread"
> java.lang.NoSuchMethodError:
> org.robovm.objc.block.VoidBlock.toNative(Ljava/lang/Object;)J
> at
> org.robovm.cocoatouch.uikit.UIViewController.objc_presentViewController(Native
> Method)
> at
> org.robovm.cocoatouch.uikit.UIViewController.objc_presentViewController(Native
> Method)
> at
> org.robovm.cocoatouch.uikit.UIViewController.presentViewController(UIViewController.java)
> at com.ultramixer.ultramixeronios.Main$1.handle(Unknown Source)
> at com.ultramixer.ultramixeronios.Main$1.handle(Unknown Source)
>
> Any ideas?
>
> Tobi
>
>
> Am 08.07.2013 um 08:57 schrieb Tobi <tobi at ultramixer.com>:
>
> Yes that Sounds good. I will try it now. Thanks for the moment.
>
> Am 08.07.2013 um 08:42 schrieb Niklas Therning <niklas at therning.org>:
>
> (I'm not sending this to the openjfx list since I don't think this belongs
> there)
>
> Please show me the exception stack trace. Does
> your UIImagePickerControllerDelegate implementation extend
> UIImagePickerControllerDelegate.Adapter (or NSObject)? Please try with
> extending Adapter if you're not doing that. I don't know how
> the UIImagePickerController works but you should be able to get hold of the
> root ViewController and somehow push your UIImagePickerControllerDelegate.
> Something like UIApplication.getSharedApplication().getKeyWIndow() should
> get you the UIWindow created by JavaFX and then you can use the
> rootViewController property to change what gets displayed.
>
>
> On Fri, Jul 5, 2013 at 2:35 PM, Tobi <tobi at ultramixer.com> wrote:
>
>> Yes I know and I tried it already. But it throws an classCastException
>> when setting the delegate to imagepicker.
>>
>> I think the problem could be that I do not use cocoa touch for the UI, I
>> use javafx.
>>
>>
>>
>> Am 05.07.2013 um 14:03 schrieb Niklas Therning <niklas at therning.org>:
>>
>> RoboVM already has bindings for most of the stuff in UIKit,
>> UIImagePickerController included [1]. It's in the robovm-cocoatouch.jar
>> file included in the download. It's mostly untested though. Please go ahead
>> and try it out and let me know how it goes.
>>
>> [1]
>> https://github.com/robovm/robovm/blob/master/cocoatouch/src/main/java/org/robovm/cocoatouch/uikit/UIImagePickerController.java
>>
>>
>> On Fri, Jul 5, 2013 at 12:26 PM, Tobias Bley <tobi at ultramixer.com> wrote:
>>
>>> Hi Tom,
>>>
>>> thats great! We need such efforts!
>>> the goal should be to use the automatically wrapped UIKit from Java,
>>> call the image picker and fetch an image from the iphone to show it in
>>> JavaFX!
>>>
>>> Who is the first guy who posts a demo image ;)?
>>>
>>> Best regards,
>>> Tobi
>>>
>>> It would be fantastic to have a real use case for using a native cocoa
>>> touch function in JavaFX (on RoboVM). I suggest to load an image via
>>> ImagePicker from the iPhone image library. So we need to use the UIKit
>>> framework and the UIImagePickerController...
>>>
>>> Am 05.07.2013 um 11:56 schrieb Tom Schindl <tom.schindl at bestsolution.at
>>> >:
>>>
>>> > Hi,
>>> >
>>> > To not write the bro stuff manually I fired up xtext yesterday and
>>> created a small DSL which holds the (relevant) Header-Information and
>>> generates the Bro-Files for you.
>>> >
>>> > You can see the input
>>> https://github.com/tomsontom/objcgenerator/tree/master/bundles/at.bestsolution.objc.mapper.cocoatouch/mappingsand output
>>> https://github.com/tomsontom/objcgenerator/tree/master/bundles/at.bestsolution.objc.mapper.cocoatouch/src/main/java/org/robovm/cocoatouch/corelocation.
>>> >
>>> > Currently it is bound to Eclipse but I could add support to run the
>>> mapper on the command line as well.
>>> >
>>> > Tom
>>> >
>>> > On 04.07.13 18:16, Tom Schindl wrote:
>>> >> Robovm does that without jni it is called bro
>>> >>
>>> >> Tom
>>> >>
>>> >> Von meinem iPhone gesendet
>>> >>
>>> >> Am 04.07.2013 um 17:44 schrieb Tobias Bley <tobi at ultramixer.com>:
>>> >>
>>> >>> Hi,
>>> >>>
>>> >>> after successfully using JavaFX (including font and CSS) on iOS I
>>> tried to call native code on iPhone. I successfully fetched and visualized
>>> the battery level of the iPhone!
>>> >>>
>>> >>> To do this I wrote objective c code and bind it to Java via JNI. No
>>> problem so far.
>>> >>>
>>> >>>
>>> >>>
>>> >>> But what I would like to do is using a technology like JNA to
>>> directly access Cocoa frameworks without writing native JNI code. Does
>>> anybody knows if JNA (or something else) could also be used in RoboVM?
>>> >>>
>>> >>> Best regards,
>>> >>> Tobi
>>> >>>
>>> >>>
>>> >>>
>>> >
>>>
>>>
>>
>
>
>
More information about the openjfx-dev
mailing list