当我点击登录Facebook按钮时,它正在打开safari浏览器并立即关闭.控制台上出现错误.
App委托方法:
func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool {
print("###### URL : ")
print(url)
print("###### App : ")
print(app)
print(options["UIApplicationOpenURLOptionsSourceApplicationKey"])
return FBSDKApplicationDelegate.sharedInstance().application(app, openURL: url, sourceApplication: options["UIApplicationOpenURLOptionsSourceApplicationKey"] as! String,
annotation: nil)
}
Run Code Online (Sandbox Code Playgroud)
2015-09-18 18:37:51.410 [21036:5050465] -canOpenURL: failed for URL: "fbauth2:///" - error: "(null)"
2015-09-18 18:37:51.417[21036:5050465] -canOpenURL: failed for URL: "fbauth2:///" - error: "(null)"
###### URL :
fb4554284912963222://authorize/?error_code=100&error_message=Invalid+Scope%3A+public&state=%7B%22challenge%22%3A%222ZmK6R5F05d%252F060TkCqj8SjPLjc%253D%22%2C%220_auth_logger_id%22%3A%223C79F2C8-61B9-470E-AE1B-E1C68435DB83%22%2C%22com.facebook.sdk_client_state%22%3Atrue%2C%223_method%22%3A%22sfvc_auth%22%7D&e2e=%7B%22init%22%3A145973.000512302%7D#_=_
###### App :
Optional(com.apple.SafariViewService)
nil
###### err:
Optional(Error Domain=com.facebook.sdk.core Code=8 "(null)" UserInfo={com.facebook.sdk:FBSDKGraphRequestErrorGraphErrorCode=100, com.facebook.sdk:FBSDKErrorDeveloperMessageKey=Invalid Scope: public, com.facebook.sdk:FBSDKGraphRequestErrorCategoryKey=0})
IDE:xcode 7 …
我已经将iPhone 6 plus更新到iOS 9测试版,并试图执行Facebook登录,但每次使用Facebook登录表单呈现UIWebView.
我有Facebook sdk
FB_IOS_SDK_VERSION_STRING @"3.24.0"
FB_IOS_SDK_TARGET_PLATFORM_VERSION @"v2.2"
Run Code Online (Sandbox Code Playgroud)
我正在使用以下方法来执行Facebook登录
NSArray *permissions = @[@"email",@"user_birthday",@"public_profile"];
FBSessionStateHandler completionHandler = ^(FBSession *session, FBSessionState status, NSError *error) {
[self sessionStateChanged:session state:status error:error];
};
if ([FBSession activeSession].state == FBSessionStateCreatedTokenLoaded) {
// we have a cached token, so open the session
[[FBSession activeSession]openWithBehavior:FBSessionLoginBehaviorUseSystemAccountIfPresent
fromViewController:nil
completionHandler:completionHandler];
} else {
[self clearAllUserInfo];
[[NSURLCache sharedURLCache] removeAllCachedResponses];
// create a new facebook session
FBSession *fbSession = [[FBSession alloc] initWithPermissions:permissions];
[FBSession setActiveSession:fbSession];
[fbSession openWithBehavior:FBSessionLoginBehaviorUseSystemAccountIfPresent
fromViewController:nil
completionHandler:completionHandler];
}
Run Code Online (Sandbox Code Playgroud)
我在plist文件下面进行了以下设置
<key>LSApplicationQueriesSchemes</key>
<array> …Run Code Online (Sandbox Code Playgroud) 我遇到了新的FBSDK问题.每当我尝试调用登录方法logInWithReadPermissions时,我收到以下错误消息:
错误:"canOpenUrl:url失败"fbauth2://"错误:"(null)"
我在dev.facebook上的ios9 tuto(https://developers.facebook.com/docs/ios/ios9)后面有我的配置.plist文件.所以,我得到了NSAppTransportSecurity字典和LSApplicationQueriesSchemes数组(上面有字符串"fbauth2")
你知道如何解决这个错误吗?
我通过Cocoapods安装了Facebook的Swift SDK:
pod 'FacebookCore', :git => "https://github.com/facebook/facebook-sdk-swift"
pod 'FacebookLogin', :git => "https://github.com/facebook/facebook-sdk-swift"
Run Code Online (Sandbox Code Playgroud)
我已经按照Facebook的Swift SDK(https://developers.facebook.com/docs/swift/login)的登录说明进行操作,但无法使其正常工作.
在我的视图控制器中,我有以下内容:
@objc fileprivate func facebookSignIn() {
let loginManager = LoginManager()
print("LOGIN MANAGER: \(loginManager)")
loginManager.logIn([ .publicProfile, .email ], viewController: self) { loginResult in
print("LOGIN RESULT! \(loginResult)")
switch loginResult {
case .failed(let error):
print("FACEBOOK LOGIN FAILED: \(error)")
case .cancelled:
print("User cancelled login.")
case .success(let grantedPermissions, let declinedPermissions, let accessToken):
print("Logged in!")
print("GRANTED PERMISSIONS: \(grantedPermissions)")
print("DECLINED PERMISSIONS: \(declinedPermissions)")
print("ACCESS TOKEN \(accessToken)")
}
}
}
Run Code Online (Sandbox Code Playgroud)
"登录经理:等等" 单击按钮打开时打印.我可以通过Facebook登录,然后网页视图变为空白,没有任何反应.该应用程序显示在我的Facebook应用程序中,因此已经进行了一些授权,但是如果我在Web视图中单击"完成"按钮,则回调的结果是.cancelled …