Swift 3 ,how reload a view if login fails - ios

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.

Related

How to handle the Return to Safari button click from ios app

I have an app that is launched from a url in safari. On the top of the app is a < safari button that returns to the calling safari tab. I would like to my app to handle the event and close resources that I'm using when the < safari button is tapped.
I've searched with no success.
There is no way to know that a user tapped the "return to previous app" link in the status bar.
All your app can detect is that it has entered the background. But of course that could happen for many other reasons.

How can I remove the new back-to-previous-app iOS 9 button from my app?

For example, when a user logs in to my app with Facebook, I open the Facebook app for auth, and then the Facebook app switches back to my app. But from then on, "Back to Facebook" stays in the top-left.
At this time, I do it by hiding status bar. I am still looking for a better solution.

Facebook login in an iOS app

I am wondering how things should work when using facebook login in an iOS app.
I have set up a trial app in order to understand the facebook login process within an iOS app.
I have a “Login with Facebook” button. When I tap it for the first time, it goes asking for permissions, then I tap YES and it comes back to my app.
At this point all is fine, I have a “Log out” button. I tap it, I get logged out as expected and can see the “Login with Facebook” button again.
Now here comes the question. When I tap the “Login with Facebook” button for the 2nd (or Nth) time, it shows me the facebook Confirm page displaying:
“You have already authorized THIS APP”
with a Cancel and an OK button.
Is this the way it should be?
It seems to me that the user knows he has already authorized THIS APP and does not need to be prompted each time.
In other words after tapping the “Login with Facebook” button it should not go through the facebook Confirm page.
Am I wrong?
If NO, why is this happening in my app?

How to return to app if user cancel Facebook Login?

I m working on facebook login. Everything is fine, when I tap on the login button it will take me to safari (or FB app) and ask me for FB login.
my question is how to make safari return to my app if I decide not to login and hit cancel button? its currently taking me to my facebook main page after hitting cancel and is not useful
thanks in advance!
I don't know how to do it exactly as you suggest but what you could do is create another view controller with a web view inside of it, and a navigation bar at the top that has a cancel button on it. This way they could log on to facebook from within the app, so they don't have to switch between things which can be a little lengthy! It would also allow an easy cancel button with 'dismissModalViewController' or whatever it has changed to in iOS6. I believe this should work :)

Prevent application from entering background, requiring a code to close app

I would like to add functionality to my iPad app such that, when the home button is pressed and my app is about to enter the background, a message box pops up requesting a code. Only if the correct code is entered will the application go into the background, otherwise the app will not close.
Is this possible?
Short answer, no it's not possible.

Resources