iOS restore state issue - ios

I recently upgraded my old iPhone app and the new state restore iOS 3/4 feature has introduced a problem. I don't know the name of this restore state feature - what is it called?
Here is my problem scenario:
I navigate into a detail screen on my app. I click a button to navigate to an address and it launches google maps as expected. Then I launch my app again. It briefly shows the last screen I was on, but immediately launches the google map again.
What I want is to simply restore the detail screen that I was last on.
Any hints?
thanks

It is called multitasking, and it is built in automatically when you build under iOS 4.0+. Without you posting any code, it is tough so say, but why don't you put a breakpoint at the line that redirects to Google Maps and see what is calling it. Then you can backtrack to see why it is being called on the reopening of the app.

Related

Request for access to photo library prompt stays in the background

My request for photo library permissions prompt is supposed to pop up as soon as the app is launched. I have set up my info.plist with the library permission.
I have tried both adding/removing the requestAuthorization(_:) function in my AppDelegate.swift in various lifecycle functions.
Current output: The app launches and stays on the launchscreen. When i click on the home button the app minimizes and the permissions prompt appears(as though it was lingering in the background). On allowing permission everything launches as expected.
Desired output: The app launches and the photo library permissions prompt appears on top(as it should). On click of which everything runs as usual.
I can attach pictures if this is not descriptive enough. Also there is no pertaining code as i have removed the requestAuthorization(_:) function(cuz not required). Any tip would go a long way as I have been fiddling with this for days now trying to get this fixed. Thank you!
Your request call should be in the view controller (i.e. viewDidAppear), not the AppDelegate. Having the call in the app delegate is probably causing it to fire at an inappropriate time.

Start app and navigate to the view previously displayed

I have an app (iOS, Swift) which is usually started in the morning by the user. The user will press a couple of buttons, enter some text, move to other views (using a navigation controller) and so on. When everything is filled out the right way, the user will put the iPhone into standby mode. As far as the app life cycle is concerned, it will enter the background state. When the user opens the app again, he will still be on the same page, with the same parameter, ... Everything is fine.
In case of a suspended app (due to a lack of resources or other stuff), the app will start again from the beginning and not from the view where the user has navigated to before. In such a case, what's the best way to navigate to the specific view the user was when bringing the phone into the standby mode and keep respectively build up the whole navigation stack as it was before the suspension?
You can use Apple state restoration and preservation technique for this purpose. Here you can find an example provided by Apple.
Hope this will help.

Prevent Google Cardboard Pairing / Startup Screen on iOS

When my google cardboard app starts up for the first time, it launches a Google page that says "Google Cardboard. Let's get you set up. Pair your phone with your viewer for the best experience."
I'd like to control this experience to show my own initial screen before the google cardboard sdk launches. One reason for this is that I want people without cardboard to be able to immediately start experiencing the app in non-cardboard mode without having to go through the pairing process.
I know I can launch the pairing / viewer profile selector later on with the cardboard.ShowSettingsDialog().
One way to do this with the current version of the SDK is to have a starter scene without a Cardboard component in it. It will not be in VR, and it won't trigger onboarding.
[edit] The function OnFocus() in CardboardiOSDevice.cs is where it decides to launch the onboarding dialog. You can suppress that by editing this function. But you may want to continue using the onboarding dialog for first time users, rather than the settings dialog, because of it walks them through the scanning process.

iOS caches the application screen when clicking the home button for the device

we are developing hybrid application on Worklight.
After the user launches the application on iOS, he will see the login screen, providing his credentials, he is inside our application.
Now, if the user clicked the home button for iOS before "logging out" from the app, the iOS will take a snapshot and store it inside the device cache.
By using IExplorer, I can see this screen cached, which in our situation a high critical issue.
How can I a override this screen with a white screen, in case the user clicked the home button of the iOS device it will be populated immediately, and the device will not snapshot the user main screen.?
Is there any thumbnail I can add to my nativeResource folder for iOS to solve this issue?
thank you.
I encourage you to look at the Worklight Knowledge Center. In most cases, you will find your answer.
To control the snapshot taken by the OS when moving to the background, you need to use the following API methods, depending on your needs:
WL.App.BackgroundHandler.setOnAppEnteringBackground and WL.App.BackgroundHandler.setOnAppEnteringForeground

Reset View hierarchy iOS

I'd like to add some code to the app delegate that resets the view hierarchy back to the beginning.
My app is basically a demonstration mockup, and I'd like EVERYTIME the app opens that it resets to the first view in the storyboard, and doesn't remember what page the user was on when they closed or 'minimized' the app.
I'm using iOS sdk 8.1, and Xcode 6.
Putting aside that it's actually quite bad user experience - it's very easy to do. You just need to specify that your app doesn't run in the background, and each time user closes app, next time - brand new copy will be launched.
Here is what you need to set in your project properties in Xcode:
If your'r info.plist Show raw keys/values option are enabled, the property is named UIApplicationExitsOnSuspend which you can get by right clicking on the empty space of info.plist properties table and selecting Add Row option as follows
and right after that you will be presented with following option,
where you can select second options which is Application does not run in the background.
Selecting the mentioned property and setting it to YES, the app opt out of background mode and it cycles between the not-running, inactive, and active states and never enters the background or suspended states and moved back to the not-running state. In other words, iOS will not preserved any states which allows the app to run as fresh on next launch.

Resources