0
votes

I am working on Worklight 6.0. I have created an hybrid application with native ios component (environment).I need to navigate from web to native page.For that I am using a plugin which has a method

    WL.NativePage.show('FirstViewController', backFromNativePage, params);

I could able to navigate from web to native and native to web. From FirstController, I am presenting SecondViewController and app flow goes on.In one of the Controller, I have added native CAMERA, I am saving and displaying all the captured images in the FinalViewController,and I am presenting FirstViewController again from the FinalViewController.From the FirstViewController I am going back to web page. Using WL.NativePage.show loading the FirstViewController (WHICH IS THE FIRST NATIVE PAGE).

Now the problem is, I couldnt able to present the SecondViewController from the FirstViewController.I am getting prompt as

    "Attempt to present <CameraViewController: 0x1d5e1e70>  on <FirstScreenViewController:
     0x1e88bec0> which is already presenting <CameraViewController: 0x1e8938b0>".

I dono where it goes wrong.Help me in solving this.

1

1 Answers

0
votes

So your flow is

web -> VC1 -> VC2 -> more VCs -> finalVC -> VC1 -> using WL API to return to web page

Looks like your navigation stack is somewhat circular and not linear, which typically complicates things a bit. You're not discarding previously instantiated view controllers before creating new instances. While technically this might be OK for most ViewControllers some might have issues with that because of exclusive hardware access required, e.g. Camera.

Bottom line - I'd recommend making sure that you're discarding view controllers once you're not requiring them anymore, e.g. by making your screen navigation stack linear or manually making sure they are destroyed.