Facebook logout button (iOS SDK) proper segue upon logging out - ios

I have ran into some trouble when using facebooks login framework. Logging in is fine, simple and works. My problem is when I click the FBSK logout button there is a verification (are you sure...) that pops up which stops me from using an action segue - what if the user says no, how can you ensure the segue runs only on confirmation?
So I am puzzled as to how to segue from one controller after the logout is successful because putting code in the viewDidAppear function doesn't work because the view isn't being refreshed, only the label changing from 'logout' to 'login'.
Update: Opted for #IBAction methods and used FBSDKLoginManager.logOut() to logout, however this removes the verification part and also opens the login pop-up straight away.
So I am still open to any suggestions.

The comment on your question is correct, get your view controller to conform to FBSDKLoginButtonDelegate and then control-click it to inspect the header file for your version of the SDK and what methods to implement.
Don't forget to tell your button its delegate is your view controller.

Related

Why apple login sheet in iOS 13 shows `null` as the app name

Within the application's webview I open the apple page for login. In the app, the iOS system knows it comes from apple so the action sheet shows up for biometric authentication.
All good and all works fine. I can authenticate myself and I will be successfully logged in. The icon in the action sheet is loaded from the app, but the app name is not present. Instead it shows null.
Currently I tried to
add title to navigation item,
add title to web view controller within the navigation
the webview title however is empty. It is out of my scope to set this up, because the webpage comes from apple.
I added App Name to WKWebView in storyboard (btw, I can't seem to figure out what exactly is App Name in this case as WKWebView doesn't seem to have any reference in the code and no documentation)
As far as I know the icon in the action sheet is loaded from the application, so I would believe the name would also be loaded from the app.
Please see the screen view.

How to stop segue from automatically unwind

I am working on an app on xcode Version 6.2, it is quite a simple app. You can register and login for now however whenever i try to login with the correct username and password it loads the "protected" page the automatically sends me back to login page showing me this error code:"2015-10-25 23:22:48.254 Test[46561:6996119] Warning: Attempt to present on whose view is not in the window hierarchy!". When i stop building the app and then build it loads the "protected" page and i am signed in and can logout.
I am quite new to xcode and i followed a tutorial on Youtube then tried to modify it.
I am using Parse to store data if that is to any help..
I can provide the view of the different views and code
It is hard to debug without any further info, but my guess is that you are likely trying to present a view controller whose views you are adding into the UIAlertView that pops out that notifies whether your login is successful. So for example, if you are trying to add some views into the UIAlertView after it has been dismissed, this error will show up.
If that is the case, use presentViewController:animated:completion in your login view controller to present the secret page instead.
If that doesn't help, please post the code regarding your login completion block from Parse.
My view hierachy
When i login(purple page), the initial page(green page) is presented before "protected"(red page) is loaded.

How to remove GPPSignInButton's default style (text, G+ image) to add your own in iOS

We're using the GGPSignInButton to log into GooplePlus service.
we want to have a custom look and feel for the button, but I couldn't find a way to turn off the text and image that show up with the button automatically when I tell a UIButton he is of a kind GPPSignInButton. Here's how it looks when I add my own design inside an otherwise empty button which is GPPSignInButton:
The only way I've been able to make it disappear is pretty patchy:
(First wire up the button to a IBOutlet called gPlusButton)
[self.gPlusButton.subviews[0] removeFromSuperview];
I also tried using my own button, and when pressed calling manually to
[[GPPSignIn sharedInstance] authenticate]
method seems to result in an incorrect login (for example, the login token isn't saved into the key chain Google+ later uses to silently authenticate me).
Does anyone know of a better way to design my own style for the button?
BTW it appears this is supported for web sign in buttons.
Just don't use the GPPSignInButton! Your idea of calling authenticate directly is correct - just make sure you are configuring the shared instance (including the delegate and so on) before calling authenticate.

Must openSessionWithAllowLoginUI only when click Facebook login button in iOS

After implementing Facebook login with success in iOS, I need now to call the loginUI only when the user click on the login button. I do not know the right place in my code to call the openSessionWithAllowLoginUI method. I have placed it at viewDidLoad, but it calls the loginUI without user click and don't want this. Anyone?
After trying many possible solutions to handle the login button, I found the better way to do this. Had implemented my own button with the same appearance of the original button and attached the action.

disable external url links in UIWebView

I used some open resource to handle my external links in WebView, so right now every time I click the url a new view would show the page with "Done" "back" "forward" "open link in safari" something like that. But at the same time the earlier webview of my app is still loading and show the url website. How could I stop it? When the user click Done for the new page, definitely they want to go back to the earlier page.
here is the open resource class I used : https://github.com/samvermette/SVWebViewController
Thanks. wish I made myself clear. I'm new here, and also new to ios development.
Not entirely clear what you're asking but every time a link is clicked in a UIWebView, the UIWebView delegate shouldStartLoadWithRequest method gets called.
If you don't want the link to load you simply return NO from this method.
There are also properties in the UIWebView class to enable you to go back or go forward through the page history.
If that doesn't answer your question, can you try and rephrase it.

Resources