ios 10 and camera crashing when app paused

36 views
Skip to first unread message

mcell...@gmail.com

unread,
Oct 28, 2016, 10:54:41 AM10/28/16
to CodenameOne Discussions
Hi, I replied to an email from Steve about my original thread regarding this but didn't see this reply on the original message thread so thought I'd re-paste it here just in case. 

I have done some further investigating and created a small demo app rather than using the photos within my own code. I have a very simple app with a single class - I have pasted the class code below. I can't really create an app for you to run as it's apple so had to build it with my own certificate/provisioning profile etc.

I have a button which calls Capture.capturePhoto(); and does nothing else. As it is difficult to see if the app has restarted, in the init() method I have a label which logs the current UTC Time.

Upon running it, if I do not press the button I can go back to home screen, restart the app and the time displayed does not change, ie it has not restarted. If I take a photo, come back to the form, then even just press the home button then open the app again the time displayed has changed, the application has crashed and restarted

This is obviously more noticeable in my real app as the user gets the splash screen back and has to log in again and will have lost any unsaved work.

The sample code to test this is :-

public class MyApplication {

    private Form current;
    private Resources theme;

    public void init(Object context) {
        theme = UIManager.initFirstTheme("/theme");

        // Enable Toolbar on all Forms by default
        Toolbar.setGlobalToolbar(true);

        // Pro only feature, uncomment if you have a pro subscription
        // Log.bindCrashProtection(true);
       
        Form hi = new Form("Welcome", new BorderLayout(BorderLayout.CENTER_BEHAVIOR_CENTER_ABSOLUTE));
        final Label apple = new Label(theme.getImage("apple-icon.png"));
        final Label android = new Label(theme.getImage("android-icon.png"));
        final Label windows = new Label(theme.getImage("windows-icon.png"));
      
 
        Calendar cal = Calendar.getInstance();
        long time = cal.getTime().getTime();
        Label l = new Label("Time start is " + time);
        Button b1 = new Button("Take a Photo");
        b1.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                final String photoPath = Capture.capturePhoto();
               
            }
        });
        hi.addComponent(BorderLayout.NORTH, l);
        hi.addComponent(BorderLayout.CENTER, b1);
        hi.show();
    }
   
    public void start() {
       
    }

    public void stop() {
        current = Display.getInstance().getCurrent();
        if(current instanceof Dialog) {
            ((Dialog)current).dispose();
            current = Display.getInstance().getCurrent();
        }
    }
   
    public void destroy() {
   
    }

}

Shai Almog

unread,
Oct 28, 2016, 10:21:55 PM10/28/16
to CodenameOne Discussions, mcell...@gmail.com
Hi,
this is probably more effective via the issue: https://github.com/codenameone/CodenameOne/issues/1895#issuecomment-256682244

I'm sure Steve will take another look at it again.

Paul McEllin

unread,
Nov 1, 2016, 5:22:36 AM11/1/16
to Shai Almog, CodenameOne Discussions

Thanks Shai. We are getting a lot of grieffrom customers about this issue now. I’m afraid.

 

Paul

 

Sent from Mail for Windows 10

Shai Almog

unread,
Nov 1, 2016, 9:23:12 PM11/1/16
to CodenameOne Discussions, shai....@gmail.com, mcell...@gmail.com
I noticed Steve made a suggestion on this today.

Reply all
Reply to author
Forward
0 new messages