Search code examples
codenameonephoto-gallery

Codename One : Open picture on iOS with execute()


I need to open a photo collage (an image) the user made. So I use Display.getInstance().execute(montage.getMontageFullPath()); which works on Android device and Codemane One simulator but not on iOS (neither on the device nor on Xcode Simulator).

The image is saved as expected on the iPhone album but it does not open as it used to be. The only change I made to my code is to use the native interface to make the image appear on the album (ie the photo gallery).

I read this blog posting about canExecute(String url) but when I use it, it is null on Android so if I use it as a test before running execute(), the latter is never run. I can't remember what happened on iOS, but the gallery was not open either.

What are the reasons why execute() would not open an image on iOS whereas it does open the image on Android and on CN1 simulator ?

Thanks for helping me,


Solution

  • The canExecute method is a 3 mode result:

    • null - means unknown
    • True means it should work
    • False means it shouldn't work

    So you can treat null & true as the same.

    This should work implicitly in iOS see this newer post but make sure that the URL you give is one within your app home otherwise we can't make any guarantees.