FBSDK 4.8登录canOpenURL:URL失败:“fbauth2:/” - 错误:“(null)”

时间:2015-11-22 09:35:50

标签: ios facebook swift

我在我的应用程序中添加了登录facebook按钮。但是当我按下按钮时,我收到了这个错误。我阅读了facebook文档,我做了他们所说的一切。

我像这样配置了info.plist文件。

    <key>LSApplicationQueriesSchemes</key>
    <array>
        <string>fbapi</string>
        <string>fbapi20130214</string>
        <string>fbapi20130410</string>
        <string>fbapi20130702</string>
        <string>fbapi20131010</string>
        <string>fbapi20131219</string>    
        <string>fbapi20140410</string>
        <string>fbapi20140116</string>
        <string>fbapi20150313</string>
        <string>fbapi20150629</string>
        <string>fbauth</string>
        <string>fbauth2</string>
        <string>fb-messenger-api20140430</string>
    </array>
<key>NSAppTransportSecurity</key>
<dict>
    <key>NSExceptionDomains</key>
    <dict>
        <key>facebook.com</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>                
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
            <false/>
        </dict>
        <key>fbcdn.net</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
            <false/>
        </dict>
        <key>akamaihd.net</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
            <false/>
        </dict>
    </dict>
</dict>

我仍然收到此错误。

if((FBSDKAccessToken.currentAccessToken()) != nil) {
            self.activityIndicator.hidden = false
            self.activityIndicator.startAnimating()
            self.performSelector("getLoginDetails",withObject: nil, afterDelay:  0.0)
        }

它也没有getLoginDetails功能。我该怎么办呢。

func getLoginDetails() {
        self.fbLoginButton.readPermissions = ["public_profile","email"]
        let graphRequest = FBSDKGraphRequest.init(graphPath: "me", parameters: ["fields":"name,id,first_name,last_name"])
        graphRequest.startWithCompletionHandler { (connection, result, error) -> Void in
            if(error != nil) {
                print(error)
            } else {
                let user = PFObject(className: "User")
                user["name"] = result.valueForKey("first_name") as! NSString
                user["last_name"] = result.valueForKey("last_name") as! NSString
                user["facebookuserID"] = result.valueForKey("id") as! NSString
                user.saveInBackgroundWithBlock({ (success, error) -> Void in
                    if(success) {
                        self.performSegueWithIdentifier("showChannels", sender: nil)
                    }else{
                        print(error)
                    }
                })

            }
        }

    }

我重置了模拟器的内容和设置。它也没有用。 谢谢你的帮助。

0 个答案:

没有答案