(com.facebook.sdk.login error 304.) Error with FBSDK 4.2
It seems I was doing
[FBSDKAccessToken refreshCurrentAccessToken:^(FBSDKGraphRequestConnection *connection, id result, NSError *error){}
in a background thread during login operation. I removed that and It worked perfectly fine.
Login failed with facebook. It works with one facebook account, yet it throws an error when trying with another account
Sometimes fbloginresult.grantedPermissions
will be nil.i am using below code
self.fbLoginManager = FBSDKLoginManager.init()
fbLoginManager.loginBehavior = FBSDKLoginBehavior.web
self.fbLoginManager.logIn(withReadPermissions: ["email"], from: self) { (result, error) -> Void in
if (error == nil) {
let fbloginresult : FBSDKLoginManagerLoginResult = result!
if fbloginresult.grantedPermissions != nil && fbloginresult.grantedPermissions.contains("email") {
if((FBSDKAccessToken.current()) != nil){
FBSDKGraphRequest(graphPath: "me", parameters: ["fields":"id, first_name, last_name, email, gender, birthday, location"]).start(completionHandler: { (connection, result, error) -> Void in
if error != nil {
print(error?.localizedDescription ?? "error in facebook login...!")
return
}
if let dict = result as? NSDictionary {
print("facebook login result --->\n\(dict)")
guard let id = dict["id"] else {
print("Ooops... id = nil")
return
}
let firstName: String = dict["first_name"] as? String ?? ""
let lastName : String = dict["last_name"] as? String ?? ""
let email : String = dict["email"] as? String ?? ""
print(firstName,lastName,email)
// here you can process your next step
self.fbLoginManager.logOut()
}
})
}
} else {
print("facebook ---> login canceled")
}
} else {
print(error?.localizedDescription ?? "facebook login has error")
}
}
Related Topics
How to Control Shadow Spread and Blur
Cordova: Start Specific iOS Emulator Image
How to Draw a Smooth Circle with Cashapelayer and Uibezierpath
Over the Air (Ota) iOS IPA File Distribution for Public
Using Tesseract to Recognize License Plates
How to Use Charles Proxy on the Xcode 6 (iOS 8) Simulator
Sizing a Container View with a Controller of Dynamic Size Inside a Scrollview
Copy Text to Clipboard with iOS
How to Delete an App from Itunesconnect/App Store Connect
Shake Animation for Uitextfield/Uiview in Swift
iOS 9 Searchbar Disappears from Table Header View When Uisearchcontroller Is Active
Uitextview Disabling Text Selection
How to Detect If Code Is Running in Main App or App Extension Target
iOS Present Modal View Controller on Startup Without Flash
Xcode Info.Plist Build Variable ${Product_Name:Rfc1034Identifier} Seems Completely Undocumented
Xcode & Swift - Detecting User Touch of Uiview Inside of Uiscrollview
Warning: Attempt to Present Viewcontroller Whose View Is Not in the Window Hierarchy