Go back to previous application Iphone Swift 3 - ios

I Have two Apps and one call the other App using UIApplication.shared.openURL
In second app there is a button in status bar to back to previous app.
There is some function to back to previous application without pressing this button in status bar?
Image example. This button.

You might try seeing what happens if your second app does an openURL back to your first app. Does iOS really nest back and forth or does it simply remove the "Back to " button? Worth a try!

Related

Swift 3 ,how reload a view if login fails

When I launch my app I have to use TouchID to login. It works correctly if I log, but If I click on "Cancel" button the app shows me a white view. I would like the app to totally close and go to the Home.
I tried it but when I click on the app logo again it appears as white page
UIControl().sendAction(#selector(URLSessionTask.suspend), to: UIApplication.shared, for: nil)
As alternative way I would like also that appear again the main page in which I have to use TouchId.
How can I do it?
You can as a user to login with TouchID in applicationWillEnterForeground (each time when an app opens). In case if you use TouchID for secure app entering. You can not close an app programmatically. It's prohibited.

Do apps like Twitter implement custom relaunching when opened from background?

I've noticed that when I go off an app like Snapchat, Twitter etc for a few seconds then go back on it, it opens from background as expected, on to the view controller I was last on. However, if I go off the app for more than a few minutes, when I tap on the app it loads the splash screen again and opens the home page.
I initially thought this was standard iOS behaviour, but when I installed my app onto my device I have noticed that even if I go off it for hours, when I come back onto it, the last view controller I was on is shown.
I have thought about checking how long the app was in background by saving times in NSUserDefaults, but don't actually know if this is the right way of going about achieving that kind of behaviour?
Thanks!

UIAlertView is not shown when returning from sleep mode in iOS app

My app must sometimes show an UIAlertView when the Home button or the locking button is pushed or when the notification center is shown.
I show the Alert from the applicationWillResignActive delegate's method and everything is ok when home button is pushed or when notificacion center is shown. But there is a problem if the button which is pushed is the locking button (on/off button).
In that case, the Alert is not shown when I return to the app (if I used the Home button it is there). I don't do anything else in other AppDelegate methods which are executed. Also, then, when I show a new Alert (any Alert in the app) the Alert which hasn't been shown when I returned is shown after I dismiss the new one.
Please, could anybody help me?
Thanks in advance.
THE EASY, GIVE ME REP ANSWER:
When the app is put into the background, the app is suspended. Part of this process is closing open alert views.
THE I ACTUALLY KNOW WHAT I'M TALKING ABOUT ANSWER:
The logic behind this is that when the user hits the home button when an alert is displayed, they might be going to look for information on how to answer the alert. However, when the sleep button is pressed, the user has stopped using the device altogether. Apple knows that if they unlock thier device again 3 hours later and see something like Confirm Deletion, they will have absolutely no idea what they were just doing and what to do now.
This is known to cause a serious condition known as what-in-the-world-am-I-supposed-to-do-now-itis. Symptoms of this condition include hitting the round button at the bottom of the screen and subsequently holding on your app icon until it jiggles. They then hit the little 'x' button. This is not good for developer's pockets.

Bring previous app back to the front when user is done with my iOS app

My iOS 4/5/6 app is meant to be used briefly. I want the user to click a "Done, now go away" button which takes them back to the app they were using before mine came to the front.
Is there a way for my iOS to put itself in the background while returning the previous app to the front?
On an iPad, the user can get that effect by doing a four-finger swipe horizontally across the screen. But that gesture is not a complete solution because (a) that gesture does not work on a handheld device, and (2) not many users know of that gesture. I want to programmatically return the previous app to the front.
I want the user to click a "Done, now go away" button
That button is the Home button.
I want to programmatically return the previous app to the front.
There's no public API for switching to another app. Users have a number of options for switching between apps, though. In addition to the swipe gesture you mentioned, they can do a four-finger upward swipe to get to the list of recent apps, or double-tap the home button for the same effect, or hit the home button once to go back to Springboard. Users, not apps, are supposed to be in control of which app is in the foreground. And the way they do that should be standard from one app to another. I can understand wanting to make life easier for the user, but what you're trying to do just isn't possible with the available API.
I Don't think you can do that if the previous application is not your property or if you are not aware if a URL Scheme has been incorporated in the previous application that you know of.
Launch App Via URL Scheme!

iOS Always be on Startpage when App becomes active

I'm programming a quiz for the iPad and when the user presses the homebutton while in a quiz and relaunches the app I want the quiz to be already cancled and back on the Startpage of the app.
Now it simply gets back to the last view it was on.
Also I want it to show the splashscreen again when the app relaunches.
A complete reset of the app, when pressing the homebutton, would be great.
Thanks in advance
Choose the 'application does not run in background' option in your project's plist. If the option isn't there, press the '+' on the side to add the property.
This will ensure that the app starts afresh every time it's opened.
So, you want to disable multitasking?
Set UIApplicationExitsOnSuspend = YES in your info.plist.
Unless you just want them to resume through the screen, in which case you'll want to look into the lifecycle callbacks for your AppDelegate.

Resources