I've integrated Parse Framework with all Facebook dependencies to my App. My plist configuration looks like this:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fbXXXXXXXXXXXXX</string>
</array>
</dict>
</array>
<key>FacebookAppID</key>
<string>XXXXXXXXXXXXX</string>
<key>FacebookDisplayName</key>
<string>XXXXX</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>facebook.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
<key>fbcdn.net</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
<key>akamaihd.net</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
</dict>
</dict>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbauth2</string>
</array>
My Login code looks like so:
PFFacebookUtils.logInInBackgroundWithReadPermissions(permissionsArray, block: { (user, error) -> Void in
if(error != nil){
print("Login failed")
}else{
if let currentUser = user{
if(currentUser.isNew){
print("New user")
}else{
print("Login success")
}
}else{
print("Login canceled")
}
}
})
All works well, however the login process is being done in Safari and not in the installed Facebook App.
What am I missing?
Build and run your iOS app, you should see a blue color Facebook login button at the center of the screen. Click on the login button, you will be presented the Facebook login page. Enter the test user’s email address and password to proceed with login. If you setup everything correctly, you should see a confirmation page.
When people log into your app with Facebook, they can grant permissions to your app so you can retrieve information or perform actions on Facebook on their behalf. The following steps are for adding Facebook Login to your iOS project.
Go ahead and copy the bundle identifier from your Xcode project’s application target and paste it into the “Bundle ID” field. After that turn on “Single Sign On” and then click “Save Changes”. With that, you have completed the setup required on your Facebook app.
Replace the code in AppDelegate.swift method with the following code. This code initializes the SDK when your app launches, and allows the SDK handle results from the native Facebook app when you perform a Login or Share action.
Since iOS 9 Facebook SDK no longer offers authorisation via Facebook App. The reason is that users will be prompted before app can open other app and this affects UX.
Your only option is to use FBSDKLoginBehaviorSystemAccount or FBSDKLoginBehaviorBrowser
PFFacebookUtils.facebookLoginManager().loginBehavior = FBSDKLoginBehavior.SystemAccount
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With