I have an iPad app and its used in a hotel for guests. So multiple users use the app through Facebook login and after the usage I need to logout the user from the app. So the next user will have the login screen again. I'm doing this in logout process and when I call the login function Its not giving the login screen. Instead it give me the already authorized screen. (With ok and cancel button). Please help to resolve this issue.
To login:
FBSDKLoginManager().logInWithReadPermissions(["email", "public_profile"], fromViewController: self, handler: { (result, error) -> Void in
if error != nil {
print("error : \(error.localizedDescription)")
} else if result.isCancelled {
print("user cancelled")
} else {
print("success")
}
})
To Logout :
FBSDKLoginManager().logOut()
FBSDKAccessToken.setCurrentAccessToken(nil)
FBSDKProfile.setCurrentProfile(nil)
let storage = NSHTTPCookieStorage.sharedHTTPCookieStorage()
for cookie in storage.cookies! {
storage.deleteCookie(cookie)
}
NSUserDefaults.standardUserDefaults().synchronize()
It will always give you an already authorized screen because Facebook is not responsible to logout from the Safari browser.
You are logged out from the login manager it is fine.
For this situation you can use the loginBehavior property of FBSDKLoginManager
You have to set the behavior to the Web it will open popup to login.
let fbManager : FBSDKLoginManager = FBSDKLoginManager()
fbManager.loginBehavior = FBSDKLoginBehavior.Web
fbManager.logInWithReadPermissions(["email"], fromViewController: self) { (result, error) -> Void in
if error != nil {
print(error)
}
else {
print(result)
}
}
You can do the logout from the manager as per your need.
Hope it will help you.
clear your facebook token from ios like this... this make user to login every time in app
ACAccountStore *store = [[ACAccountStore alloc] init];
NSArray *fbAccounts = [store accountsWithAccountType:[store accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook]];
for (ACAccount *fb in fbAccounts) {
[store renewCredentialsForAccount:fb completion:^(ACAccountCredentialRenewResult renewResult, NSError *error) {
}];
}
This works for me
For objective-C
1st Define
#property(nonatomic,strong)FBSDKLoginManager *login;
Then Use this method.
-(void)logoutFromFacebook{
if(self.login){
[self.login logOut];
}else{
self.login = [[FBSDKLoginManager alloc] init];
[self.login logOut];
}
}
For Swift
var login: FBSDKLoginManager?
func FBSDKLoginManager () {
if self.login != nil {
self.login.logout()
}else {
self.login = self.login()
self.login.logout()
}
}
Hope this will help.
Here is a working solution using their custom button class FBSDKLoginButton on a view. You should only enter the protected page on view will appear if the currentAccessToken is not nil. This will prevent showing the first view for a few miliseconds. As you can see, I embeded my viewControllers in a NaviguationController.
UIView with custom class in the login view :
ViewWillAppear :
override func viewWillAppear(animated: Bool) {
super.viewDidAppear(animated)
if (FBSDKAccessToken.currentAccessToken() != nil) {
loginFacebook(FBSDKAccessToken.currentAccessToken().tokenString,
userId: FBSDKAccessToken.currentAccessToken().userID)
self.enterProtectedPage();
}
}
ViewDidLoad :
override func viewDidLoad() {
super.viewDidLoad()
loginBtn.delegate = self
loginBtn.readPermissions = ["public_profile", "email", "user_birthday", "user_relationship_details"];
}
login button click action :
func loginButton(loginButton: FBSDKLoginButton!, didCompleteWithResult result: FBSDKLoginManagerLoginResult!, error: NSError!) {
if (error != nil) {
print(error.localizedDescription)
return
}
if let _ = result.token {
loginFacebook(FBSDKAccessToken.currentAccessToken().tokenString,
userId: FBSDKAccessToken.currentAccessToken().userID)
self.enterProtectedPage();
}
}
enter protected page :
func enterProtectedPage() {
let protectedPage = self.storyboard?.instantiateViewControllerWithIdentifier("ProtectedPageViewController") as!
ProtectedPageViewController
let protectedPageNav = UINavigationController(rootViewController: protectedPage)
let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
appDelegate.window?.rootViewController = protectedPageNav
}
logout action on the protected page :
#IBAction func btnLogoutClicked(sender: AnyObject) {
let loginManager = FBSDKLoginManager()
loginManager.logOut()
let loginPage = self.storyboard?.instantiateViewControllerWithIdentifier("ViewController") as!ViewController
let loginPageNav = UINavigationController(rootViewController: loginPage)
let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
appDelegate.window?.rootViewController = loginPageNav
}
Related
I want to use Facebook for my login process with Cognito, and I've followed a lot of AWS documentation and look at tutorials and questions in Stackoverflow, but I've not found a solution for my problem.
When the user opens the app, it will check if the user is logged in using IdentityManager. If not, it will open a new view where the user can sign in using Facebook using Facebook SDK. After that, I stored the token with a custom IdentityProvider as the documentation said (credentialsProvider.logins is deprecated). Everything seems to work fine, but every time I reopen the application, my session isn't restored.
I found out that if I use AWSIdentityManager.defaultIdentityManager().resumeSessionWithCompletionHandler(handler)I restored my session, but in case the user isn't logged in, it doesn't show my custom login screen as expected, but a Safari web view to Facebook.
Here is my code:
AppDelegate.swift
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
let identityManager = AWSIdentityManager.defaultIdentityManager()
identityManager.resumeSessionWithCompletionHandler({
(result, error) -> Void in
if !identityManager.loggedIn {
let mainStoryboard : UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let initialViewControlleripad : UIViewController = mainStoryboard.instantiateViewControllerWithIdentifier("SignIn") as UIViewController
self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
self.window?.rootViewController = initialViewControlleripad
self.window?.makeKeyAndVisible()
}
})
return AWSMobileClient.sharedInstance.didFinishLaunching(application, withOptions: launchOptions)
}
SignInViewController.swift
#IBAction func openFacebookLoginScreen(sender: AnyObject) {
FBSDKLoginManager().logInWithReadPermissions(FACEBOOK_PERMISSIONS, fromViewController: self, handler: { (result, error) -> Void in
if error == nil {
let fbLoginResult : FBSDKLoginManagerLoginResult = result
if fbLoginResult.isCancelled {
print("Cancelled")
}
else {
if FBSDKAccessToken.currentAccessToken() != nil {
self.signInFacebook(FBSDKAccessToken.currentAccessToken().tokenString)
self.dismissSignInView()
}
}
}
})
}
func signInFacebook(fbToken: String){
let logins = [AWSIdentityProviderFacebook : fbToken]
let customProviderManager = CustomIdentityProvider(tokens: logins)
let credentialsProvider = AWSCognitoCredentialsProvider(
regionType:.USEast1,
identityPoolId: COGNITO_IDENTITY_POOL_ID,
identityProviderManager: customProviderManager)
let configuration = AWSServiceConfiguration(region:.USEast1, credentialsProvider: credentialsProvider)
AWSServiceManager.defaultServiceManager().defaultServiceConfiguration = configuration
}
class CustomIdentityProvider: NSObject, AWSIdentityProviderManager {
var tokens : [NSString : NSString]?
init(tokens: [NSString : NSString]) {
self.tokens = tokens
}
#objc func logins() -> AWSTask {
return AWSTask(result: tokens)
}
}
Apparently my problem was that I was calling IdentityManager.loggedIn inside AppDelegate.swift, so I move it to viewDidLoad() on my main view controller.
Also I changed my sign in code to:
#IBAction func openFacebookLoginScreen(_: AnyObject) {
handleLoginWithSignInProvider(AWSFacebookSignInProvider.sharedInstance())
}
func handleLoginWithSignInProvider(signProvider: AWSSignInProvider){
AWSIdentityManager.defaultIdentityManager().loginWithSignInProvider(signProvider) { (result, error) in
if(error == nil){
let logins = [AWSIdentityProviderFacebook : FBSDKAccessToken.currentAccessToken().tokenString!]
let customProviderManager = CustomIdentityProvider(tokens: logins)
let credentialsProvider = AWSCognitoCredentialsProvider(
regionType:.USEast1,
identityPoolId: self.COGNITO_IDENTITY_POOL_ID,
identityProviderManager: customProviderManager)
let configuration = AWSServiceConfiguration(region:.USEast1, credentialsProvider: credentialsProvider)
AWSServiceManager.defaultServiceManager().defaultServiceConfiguration = configuration
self.dismissSignInView()
}
}
}
So I am following the Facebook documentation on how to add a custom login button in iOS but I am not sure if this is a documentation error or something is up with what I had written into my project. I have followed it for verbatim.
I get errors at these lines:
"Extra argument in call ["public_profile", "user_friends", "email"]"
func loginButtonClicked() {
var login: FBSDKLoginManager = FBSDKLoginManager()
FBSDKLoginManager.logInWithReadPermissions(["public_profile", "user_friends", "email"], fromViewController: self) { (result, error) -> Void in
if let result = result where error == nil && !result.isCancelled {
// Successful login
} else {
// Canceled or error
}
}
};
}
Here below is what the rest of the ViewController looks like:
class LogInViewController: UIViewController {
#IBOutlet weak var loginButton: FBSDKLoginButton!
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
}
override func viewDidLoad() {
["public_profile", "email", "user_friends"]
super.viewDidLoad()
// Add a custom login button to your app
let myLoginButton: UIButton = UIButton(type: .Custom)
myLoginButton.backgroundColor = UIColor.darkGrayColor()
myLoginButton.frame = CGRectMake(0, 0, 180, 40)
myLoginButton.center = self.view.center
myLoginButton.setTitle("My Login Button", forState: .Normal)
// Handle cliks on the button
myLoginButton.addTarget(self,action: "loginButtonClicked", forControlEvents: .TouchUpInside)
// Add the button to the view
self.view!.addSubview(myLoginButton)
}
// Once the button is clicked, show the login dialogue.
func loginButtonClicked() {
var login: FBSDKLoginManager = FBSDKLoginManager()
FBSDKLoginManager.logInWithReadPermissions(["public_profile", "user_friends", "email"] /*Extra argument in call is here */, fromViewController: self) { (result, error) -> Void in
if let result = result where error == nil && !result.isCancelled {
// Successful login
} else {
// Canceled or error
}
}
};
}
TL;DR what is the exact problem and what is Xcode trying to tell me?
The Error is very simple that you are not parsing Object of FBSDKLoginManager that you are creating with following line:
var login: FBSDKLoginManager = FBSDKLoginManager()
So do the code like following:
func loginButtonClicked() {
let login: FBSDKLoginManager = FBSDKLoginManager()
login.logInWithReadPermissions(["public_profile", "email", "user_friends"], fromViewController: self) { (result, error) -> Void in
if let result = result where error == nil && !result.isCancelled {
// Successful login
} else {
// Canceled or error
}
}
}
Seems like the problem is the way you call the loginWithPermissions method. You could try writing it again, let xcode autocomplete for you and then press enterfor all the parameters, so that the right code is filled in for you.
However, this is an example of how calling the method should look like
loginManager.logInWithReadPermissions(["public_profile", "user_friends", "email"], fromViewController: self) { (result, error) -> Void in
if let result = result where error == nil && !result.isCancelled
// Successful login
} else {
// Canceled or error
}
}
Hope this helps you figure out your error. Let me know if it worked out :)
I am trying to add facebook login for my app. I am using the FBSDKLoginButton which comes with its own button and once you login it turns to logout. I don't want all that. I just need to add my own button a view. And in that button's #IBAction I want the facebook login to take place. The code which I am now using is
class ViewController: UIViewController,FBSDKLoginButtonDelegate {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
if (FBSDKAccessToken.currentAccessToken() != nil)
{
// User is already logged in, do work such as go to next view controller.
}
else
{
let loginView : FBSDKLoginButton = FBSDKLoginButton()
self.view.addSubview(loginView)
loginView.center = self.view.center
loginView.readPermissions = ["public_profile", "email", "user_friends"]
loginView.delegate = self
}
}
func loginButton(loginButton: FBSDKLoginButton!, didCompleteWithResult result: FBSDKLoginManagerLoginResult!, error: NSError!) {
println("User Logged In")
if ((error) != nil)
{
// Process error
}
else if result.isCancelled {
// Handle cancellations
}
else {
returnUserData()
// If you ask for multiple permissions at once, you
// should check if specific permissions missing
if result.grantedPermissions.contains("email")
{
// Do work
}
}
}
func loginButtonDidLogOut(loginButton: FBSDKLoginButton!) {
println("User Logged Out")
}
func returnUserData()
{
let graphRequest : FBSDKGraphRequest = FBSDKGraphRequest(graphPath: "me", parameters: nil)
graphRequest.startWithCompletionHandler({ (connection, result, error) -> Void in
if ((error) != nil)
{
// Process error
println("Error: \(error)")
}
else
{
println("fetched user: \(result)")
let userName : NSString = result.valueForKey("name") as! NSString
println("User Name is: \(userName)")
let userEmail : NSString = result.valueForKey("email") as! NSString
println("User Email is: \(userEmail)")
}
})
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
How do I customise this and achieve what I need. Thanks in advance.
You might want to check the latest FacebookSDK, here's what i have:
#IBAction func connectWithFacebook(){
if FBSDKAccessToken.currentAccessToken() != nil {
FBSDKLoginManager().logOut()
return
}
let login:FBSDKLoginManager = FBSDKLoginManager()
login.logInWithReadPermissions(["email"], handler: { (result:FBSDKLoginManagerLoginResult!, error:NSError!) -> Void in
if(error != nil){
FBSDKLoginManager().logOut()
}else if(result.isCancelled){
FBSDKLoginManager().logOut()
}else{
//Handle login success
}
})
}
Otherwise with the older SDK you can do the following:
Add the FBSDKLoginButton to your view and set it invisible
Add your custom button
On your custom button IBAction perform a click on the FBSDKLoginButton with the method sendActionsForControlEvents
FBSDKLoginManager can be used if FB Login is handled via custom button.
For more info, your can check this.
Set current access is nil.
This calls [FBSDKAccessToken setCurrentAccessToken:nil] and
[FBSDKProfile setCurrentProfile:nil].
FBSDKAccessToken.setCurrentAccessToken(nil)
For Facebook logout.
I have a YouTube player in my app and I am trying to add a Facebook share button on it, so users would be able to share the youtube videos.
I am using Facebook SDK 4.1 and I have successfully implemented the Login and Share functions. But for now if I need to firstly login and than share the link.
How can I merge these two processes so I will have only Share button and when this button is clicked if the user has not login than login view will be shown, if he has than the link would be shared. So I need somehow to call the login function in share button. But since I am new in swift I can’t see where are the on click actions here or how can I implement the login function without clicking the login button.
Here is my code:
let contentURL = "https://www.youtube.com/watch?v=jBsPZV14I-k"
let contentURLImage = "http://img.youtube.com/vi/jBsPZV14I-k/0.jpg"
let contentTitle = "sdasfdfsa"
let contentDescription = "asdsadasdasd"
override func viewDidLoad() {
super.viewDidLoad()
if (FBSDKAccessToken.currentAccessToken() != nil)
{
let loginView : FBSDKLoginButton = FBSDKLoginButton()
self.view.addSubview(loginView)
loginView.center = self.view.center
loginView.readPermissions = ["public_profile", "email", "user_friends"]
loginView.delegate = self
self.returnUserData()
self.showShareButtons()
}
else
{
let loginView : FBSDKLoginButton = FBSDKLoginButton()
self.view.addSubview(loginView)
loginView.center = self.view.center
loginView.readPermissions = ["public_profile", "email", "user_friends"]
loginView.delegate = self
}
}
func loginButton(loginButton: FBSDKLoginButton!, didCompleteWithResult result: FBSDKLoginManagerLoginResult!, error: NSError!) {
println("User Logged In")
if ((error) != nil)
{
// Process error
}
else if result.isCancelled {
// Handle cancellations
}
else {
if result.grantedPermissions.contains("email")
{
// Do work
}
self.returnUserData()
self.showShareButtons()
}
}
func loginButtonDidLogOut(loginButton: FBSDKLoginButton!) {
println("User Logged Out")
}
func returnUserData()
{
let graphRequest : FBSDKGraphRequest = FBSDKGraphRequest(graphPath: "me", parameters: nil)
graphRequest.startWithCompletionHandler({ (connection, result, error) -> Void in
if ((error) != nil)
{
// Process error
println("Error: \(error)")
}
else
{
println("fetched user: \(result)")
let userName : NSString = result.valueForKey("name") as! NSString
println("User Name is: \(userName)")
let userEmail : NSString = result.valueForKey("email") as! NSString
println("User Email is: \(userEmail)")
}
})
}
func showShareButtons()
{
self.showLinkButton()
}
func showLinkButton()
{
let content : FBSDKShareLinkContent = FBSDKShareLinkContent()
content.contentURL = NSURL(string: self.contentURL)
content.contentTitle = self.contentTitle
content.contentDescription = self.contentDescription
content.imageURL = NSURL(string: self.contentURLImage)
let button : FBSDKShareButton = FBSDKShareButton()
button.shareContent = content
button.frame = CGRectMake((UIScreen.mainScreen().bounds.width - 100) * 0.5, 50, 100, 25)
self.view.addSubview(button)
}
I did this work for sharing when user is not logged in but still he tap the share button. I poped up the FBLogin Window and when user finished logged in successfully, i use this code for share the game score. Note that this function only works once (or on after re-login).
This is delegate method of FB Framework. It will get response when the state of user log in changed.
- (void)sessionStateChanged:(FBSession *)session state:(FBSessionState) state error:(NSError *)error
{
if (!error && state == FBSessionStateOpen)
{
//log in
NSUserDefaults *def=[NSUserDefaults standardUserDefaults];
NSArray *arr=[def objectForKey:#"fbShare"];
if (arr.count>0)
{
int score=[[arr objectAtIndex:0]intValue];
int hScore=[[arr objectAtIndex:1]intValue];
int level=[[arr objectAtIndex:2]intValue];
BOOL isArcade=[[arr objectAtIndex:3] boolValue];
ShareScoreFB *share=[[ShareScoreFB alloc]init];
[share shareToFacebookCurrentScore:score andHighScore:hScore forLevel:level forArcade:isArcade];
[def removeObjectForKey:#"fbShare"];
[def synchronize];
}
return;
}
}
I've been frustratingly trying to implement Parse's Facebook login function into my app using Swift for over a month and can't seem to figure it out. I successfully linked my app to both Facebook and Parse separately, but I can't make a Parse user using Facebook's login. I believe the AppDelegate is setup correctly, so I will only show my LoginViewController and hopefully someone who knows what they're doing can please help me out:
import UIKit
import Parse
import FBSDKCoreKit
import FBSDKLoginKit
protocol LoginViewControllerDelegate {
func onRegister(loginViewController : LoginViewController)
func onFacebookLogin(loginViewController : LoginViewController)
func onLogin(loginViewController : LoginViewController)
}
class LoginViewController: UIViewController, FBSDKLoginButtonDelegate {
//MARK: - Outlets
#IBOutlet weak var lblStatus: UILabel!
//var delegate : LoginViewControllerDelegate?
// Set permissions required from the facebook user account
let permissions = [ "user_about_me", "user_relationships", "user_location", "user_birthday", "public_profile", "user_friends", "user_email", "user_gender"]
//MARK: - Initial Load
override func viewDidLoad() {
super.viewDidLoad()
self.lblStatus.alpha = 0
//Facebook
if (FBSDKAccessToken.currentAccessToken() != nil)
{
// User is already logged in, do work such as go to next view controller.
}
else
{
let loginView : FBSDKLoginButton = FBSDKLoginButton()
// self.view.addSubview(loginView)
// loginView.center = self.view.center
// loginView.readPermissions = ["public_profile", "email", "user_friends"]
loginView.delegate = self
}
// ---------------------------- Check if user is logged in ---------------------
if PFUser.currentUser() != nil {
println("parse: User already logged in")
performSegueWithIdentifier("loggedIn", sender: self)
}
}
//MARK: - Facebook Login Button
func loginButton(loginButton: FBSDKLoginButton!, didCompleteWithResult result: FBSDKLoginManagerLoginResult!, error: NSError!) {
if ((error) != nil) {
println(error) // Process error
} else if result.isCancelled { // Handle cancellations
} else {
// If you ask for multiple permissions at once, you
// should check if specific permissions missing
if result.grantedPermissions.contains("email")
{
// Do work
}
}
returnUserData()
}
#IBAction func facebookLoginDidPress(sender: AnyObject) {
self.lblStatus.alpha = 0
PFFacebookUtils.logInInBackgroundWithReadPermissions(self.permissions, block: {
(user: PFUser?, error: NSError?) -> Void in
if (user == nil) {
if (error == nil) {
println("User cancelled FB login")
self.lblStatus.alpha = 1
}else{
println("FB login error: \(error)")
self.lblStatus.alpha = 1
}
} else if user!.isNew {
println("User signed up and logged in with Facebook! \(user)")
self.requestFacebook()
self.returnUserData()
self.performSegueWithIdentifier("loggedIn", sender: self)
} else {
println("User logged in via Facebook \(user)")
self.performSegueWithIdentifier("loggedIn", sender: self)
}
})
}
func requestFacebook() {
let graphRequest : FBSDKGraphRequest = FBSDKGraphRequest(graphPath: "me", parameters: nil)
graphRequest.startWithCompletionHandler({ (connection, result, error) -> Void in
if ((error) != nil)
{
// Process error
println("Error: \(error)")
}
else if error == nil
{
var userData: NSDictionary = NSDictionary(objectsAndKeys: result)
var facebookID: AnyObject? = userData["id"]
var name: AnyObject? = userData["first_name"]
var gender: AnyObject? = userData["gender"]
var birthday: AnyObject? = userData["birthday"]
var pictureURL = "https://graph.facebook.com/\(facebookID)/picture?type=large&return_ssl_resources=1"
var URLRequest = NSURL(string: pictureURL)
var URLRequestNeeded = NSURLRequest(URL: URLRequest!)
NSURLConnection.sendAsynchronousRequest(URLRequestNeeded, queue: NSOperationQueue.mainQueue(), completionHandler: {(response: NSURLResponse!,data: NSData!, error: NSError!) -> Void in
if error == nil {
var picture = PFFile(data: data)
PFUser.currentUser()!.setObject(picture, forKey: "profilePicture")
PFUser.currentUser()!.saveInBackground()
}
else {
println("Error: \(error.localizedDescription)")
}
})
}
})
}
func loginButtonDidLogOut(loginButton: FBSDKLoginButton!) {
println("User Logged Out")
}
func returnUserData()
{
let graphRequest : FBSDKGraphRequest = FBSDKGraphRequest(graphPath: "me", parameters: nil)
graphRequest.startWithCompletionHandler({ (connection, result, error) -> Void in
if ((error) != nil)
{
// Process error
println("Error: \(error)")
}
else
{
if let userName : NSString = result.valueForKey("name") as? NSString {
println("User Name is: \(userName)")
} else {println("No username fetched")}
if let userEmail : NSString = result.valueForKey("email") as? NSString {
println("User Email is: \(userEmail)")
} else {println("No email address fetched")}
if let userGender : NSString = result.valueForKey("gender") as? NSString {
println("User Gender is: \(userGender)")
} else {println("No gender fetched") }
}
})
}
}
Some important notes to make:
I am using the newest version of Parse (1.7.4) and FBSDK (4.1), so most other methods I've found online do not work anymore because certain functions or members have been removed since then.
The "func loginButton" is what I used for the FBSDKLoginButton, while the "#IBAction func facebookLoginDidPres" is for a regular UIButton I tried using for logging in. Based on what I've learned recently, I believe the UIButton method is the one I should go with, but that one leads to a Thread 1: Signal SIGABRT error stating:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[PFFacebookUtils logInInBackgroundWithReadPermissions:block:]: unrecognized selector sent to class 0x10ed3ed80'
*** First throw call stack:
...
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) ""
So I placed an exception breakpoint and it ended at the end of the "logInInBackgroundWithReadPermissions" function in my IBAction with the console stating:
"[PFFacebookUtils logInInBackgroundWithReadPermissions:block:]: unrecognized selector sent to class 0x10dbe2db0 (lldb)"
The last detail I feel is worth mentioning is that my console states "parse: User already logged in" in when I run the app, however there is no User created when I check Parse. This is getting printed from the section under "check if the user is logged in" section of my LogInViewController's viewDidLoad function.
I will be forever grateful to anyone who can help me figure out this problem that's been puzzling me for far too long. Thank you in advance!
I deleted the old PFFacebookUtils Framework, but kept the PFFacebookUtilsV4 Framework, and that solved the problem for me! Hopefully that helps anyone else with this problem :)
I have the same problem, my solution is to define Login behaviour = Web
PFFacebookUtils.facebookLoginManager().loginBehavior = FBSDKLoginBehavior.Web
When I call this before call loginInBackground..., after clicking to the "OK" button, my application received call-back with a user (not nil) and PFUser.currentUser is updated with that user.