1

I noticed when I use a FileChooser class in order to get an image, it works on Android but not on iOS. I suppose it might be happening because of different work of filepath or special permissions for iOS.

Any ideas/suggestions? Thank you.

Here is my code:

ActionListener callback = e -> {
        if (e != null && e.getSource() != null) {
            String filePath = (String) e.getSource();

            cont.removeAll();
            try {
                Image originImg = Image.createImage(filePath);
                Image smallImg = originImg.scaled(getWidth()/2, -1);

                ScaleImageButton iv = new ScaleImageButton(smallImg);
                iv.addActionListener(evt->{
                    Dialog previewForm = new Dialog();
                    previewForm.addPointerReleasedListener(i-> previewForm.dispose());


                    ImageViewer imagePreview = new ImageViewer();
                    imagePreview.addPointerReleasedListener(i-> previewForm.dispose());
                    imagePreview.setImage(originImg.scaled(getWidth(), -1));

                    previewForm.setDisposeWhenPointerOutOfBounds(true);
                    previewForm.add(imagePreview);
                    previewForm.show();
                });

                cont.add(iv);
                revalidate();
            } catch (IOException ex) {

            }

        }
    };

    if (FileChooser.isAvailable()) {
        Log.p("FileChooser open");
        FileChooser.showOpenDialog(".png,image/png,.jpg,image/jpg,.jpeg", callback);
    } else {
        Display.getInstance().openGallery(callback, Display.GALLERY_IMAGE);
    }
fnklstn
  • 492
  • 4
  • 16

1 Answers1

1

If you're using the FileChooser cn1lib notice you need to make changes to the provisioning profile. See this: https://github.com/shannah/cn1-filechooser/wiki/iOS-Setup

Shai Almog
  • 51,749
  • 5
  • 35
  • 65
  • Thank you for your reply. The iOS Setup was done accordingly to this tutorial a while ago, before I created my latest provisioning profile. Just checked all the settings - everything seems to be correct. Any other hints? – fnklstn May 12 '21 at 18:51
  • 1
    I'll have to check and get back to you. – Shai Almog May 13 '21 at 02:57