2

I have looked at every single thread on here, I have the latest Parse SDK(1.8.5), I have the latest Facebook SDK(4.6). I'm using Xcode Version 7.0.1 with iOS9 and swift 2.0. I have read the Facebook API docs page over and over to make sure I am not missing anything as well as the parse API docs. Here is my view controller

import ParseFacebookUtilsV4
import Parse
import UIKit


class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        let permissions = ["public_profile"]
        PFFacebookUtils.logInInBackgroundWithReadPermissions(permissions) {
            (user: PFUser?, error: NSError?) -> Void in
            if let user = user {
                if user.isNew {
                    print("User signed up and logged in through Facebook!")
                } else {
                    print("User logged in through Facebook!")
                }
            } else {
                print("Uh oh. The user cancelled the Facebook login.")
            }
        }


    }

Here is the AppDelegate:

import UIKit
import CoreData
import Parse
import Bolts
import FBSDKCoreKit
import ParseFacebookUtilsV4

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?


    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool
    {

        Parse.enableLocalDatastore()
        // Initialize Parse.
        Parse.setApplicationId("removed",
            clientKey: "removed")

        PFFacebookUtils.initializeFacebookWithApplicationLaunchOptions(launchOptions)


        return true
    }

    func application(application: UIApplication,
        openURL url: NSURL,
        sourceApplication: String?,
        annotation: AnyObject) -> Bool {
            return FBSDKApplicationDelegate.sharedInstance().application(application,
                openURL: url,
                sourceApplication: sourceApplication,
                annotation: annotation)
    }

Here is the info.plist:

    <plist version="1.0">
<dict>
    <key>LSApplicationQueriesSchemes</key>
    <array>
        <string>fbapi</string>
        <string>fb-messenger-api</string>
        <string>fbauth2</string>
        <string>fbshareextension</string>
    </array>
    <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>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>removed</string>
            </array>
        </dict>
    </array>
    <key>FacebookAppID</key>
    <string>removed</string>
    <key>FacebookDisplayName</key>
    <string>removed</string>
    <key>CFBundleDevelopmentRegion</key>
    <string>en</string>
    <key>CFBundleExecutable</key>
    <string>$(EXECUTABLE_NAME)</string>
    <key>CFBundleIdentifier</key>
    <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>$(PRODUCT_NAME)</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>1</string>
    <key>LSRequiresIPhoneOS</key>
    <true/>
    <key>UILaunchStoryboardName</key>
    <string>LaunchScreen</string>
    <key>UIMainStoryboardFile</key>
    <string>Main</string>
    <key>UIRequiredDeviceCapabilities</key>
    <array>
        <string>armv7</string>
    </array>
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
</dict>
</plist>

No compiler issues but when I run it I get the

canOpenURL: failed for URL: "fbauth2:///" - error: "(null)"
 -canOpenURL: failed for URL: "fbauth2:///" - error: "(null)"

and when the simulator starts up just a blank screen, it does not route the Facebook login on the simulator.

Can anyone please help!

rici
  • 234,347
  • 28
  • 237
  • 341
  • Reset your simulator: choose Simulator, Select Reset Content & Settings, and select the Reset option. From [here](http://stackoverflow.com/questions/32676334/ios-9-facebook-login-simulator-canopenurl-failed-for-url-fbauth2-erro). – Kyle Pittman Oct 07 '15 at 02:41
  • tried several time as well. Doesn't fix the issue. – Alexandru Adam Oct 07 '15 at 03:04
  • I read that as well on the Facebook docs but regardless on the simulator it does not take me to the login with Facebook page – Alexandru Adam Oct 07 '15 at 04:03
  • I saw that post and I tried setting bitcode to no still doesn't work on simulator. I have all the other settings as the post mentioned – Alexandru Adam Oct 07 '15 at 04:05
  • Try it on a device. Although it shouldn't be the case, it may be because the simulator does not have the Facebook app installed? – bangdel Oct 26 '15 at 18:45
  • I can see the same problem on device (iPhone 5s iOS 11.2, pod 'FBSDKCoreKit', '4.30.0' pod 'FBSDKLoginKit', '4.30.0' pod 'FBSDKShareKit', '4.30.0') – Vit Mar 26 '18 at 10:46

2 Answers2

3

This is an error introduced by Xcode 7 and iOS9. According to Facebook's Doc: https://developers.facebook.com/docs/ios/ios9

Why do I see console messages like 'canOpenURL: failed for URL: "fb...://' or ?

This is an Xcode warning indicating the the canOpenURL: call returned false. As long as you have configured the LSApplicationQueriesSchemes entry in your plist as described above, you can ignore this warning

As long as FB login is working, and this is your only error message, you can ignore it. We get it on our production app too, hopefully Facebook will fix it in their next SDK update.

Community
  • 1
  • 1
Azellius
  • 41
  • 1
  • 5
0

you can see this link: http://myxcode.net/2015/10/28/plist-requriments-for-facebook-integration-ios-9/

its just another addiction to array:

     <key>LSApplicationQueriesSchemes</key>
 <array>
   <string>fb</string>
 </array>
Gurjot Kalsi
  • 33
  • 11