Development Tip

FBSDK 로그인 오류 코드 : Objective-C의 308

yourdevel 2020. 12. 13. 11:15
반응형

FBSDK 로그인 오류 코드 : Objective-C의 308


나는 계속

"Error Domain = com.facebook.sdk.login Code = 308"작업을 완료 할 수 없습니다. (com.facebook.sdk.login 오류 308.) ""

내 장치에서 Facebook으로 로그인하려고 할 때.

내 코드는 시뮬레이터에서 작동하지만 실제 장치에서는 작동하지 않습니다. 누구든지 전에이 오류 코드를 만났습니까? 요청시 코드를 공유해 드리겠습니다.


적어도 나에게 한 가지 해결책은 Xcode 디버거를 통해 장치에서 실행되지 않는 것입니다. 디버거 외부의 장치에서 앱을 실행하면 Facebook 로그인이 제대로 작동합니다. 디버거를 통해 시뮬레이션에서 앱을 실행하면 Facebook 로그인이 제대로 작동합니다.

Xcode 디버거를 통해 장치에서 앱을 실행하는 경우에만 매번 com.facebook.sdk.login 오류 308이 발생합니다.


아래 솔루션은 iOS9 + Xcode 8에서 실행되는 Swift3.0에서 작동합니다.

단계는

  1. Facebook 시작 설정

FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)

  1. 열기 URL 설정

    guard let source = options[UIApplicationOpenURLOptionsSourceApplicationKey] as? String else { return false } let annotation = options[UIApplicationOpenURLOptionsAnnotationKey] as? String return FBSDKApplicationDelegate.sharedInstance().application(application, open: url, sourceApplication: source, annotation: annotation)

  2. 아래 이미지와 같이 키 체인 권한 문제 수정

iOS 9 키 체인 수정


기능에서 키 체인 공유활성화해야합니다 .


나는 똑같은 문제가 있었고 Info.plist를 수정하여 해결책을 찾을 수있었습니다.

가능한 모든 계획을 추가했습니다. LSApplicationQueriesSchemes

전체 목록은 다음과 같습니다.

<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</string>
    <string>fb-messenger-api20140430</string>
    <string>fb-messenger-platform-20150128</string>
    <string>fb-messenger-platform-20150218</string>
    <string>fb-messenger-platform-20150305</string>
    <string>fb-messenger-api</string>
    <string>fbshareextension</string>
</array>

FB SDK 4.6.0 Xcode 7.0 iOS9와 똑같은 것을 얻습니다. 페이스 북 개발자 사이트의 모든 설정 및 지침은 편지에 따랐습니다. 위의 솔루션 중 어느 것도 나를 위해 일하지 않았습니다. 장치에 라이브로 배포하고 로그인 절차를 수행하는 동안 Xcode 콘솔로 피드백 할 때 동작이 더 나쁘다는 것을 알고 있습니다. 실제로 로그인 여부를 확인하는 것은 정말 행운입니다. 그것은 보인다 그냥 좀 더 예측 가능한 방식으로 행동하는 배포 후 앱 감기를 다시 시작합니다. -네, 사실입니다!

로그인에 실패하기로 결정하면 다음 오류가 발생합니다.

Error Domain=com.facebook.sdk.login Code=308 "(null)"

Xcode7.1, Swift2.0에 대한 내 솔루션

1 단계. 빌드 폴더 정리 : option+ command+K

또는 : 선택 Product>Clean

여기에 이미지 설명 입력

2 단계. 파생 데이터 정리 : Window> 선택 Projects:여기에 이미지 설명 입력

다음을 선택하십시오 Delete.여기에 이미지 설명 입력


동일한 문제가 발생하여 시스템 자격 증명을 새로 고치십시오.

[FBSDKLoginManager renewSystemCredentials:^(ACAccountCredentialRenewResult result, NSError *error) {

    [[[YourAuthManager manager] facebookLoginManager] logInWithReadPermissions:@[@"email"] fromViewController:nil handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {

        if (error) {
            // Handle error
        } else if (result.isCancelled) {
            // Handle cancellations
        } else {
            // If you ask for multiple permissions at once, you
            // should check if specific permissions missing
            if ([result.grantedPermissions containsObject:@"email"]) {
                // Do work
            }
        }
    }];
}];

이 솔루션은 재설치보다 덜 급진적이며 사용자가이를 수행 할 필요가 없음을 보장합니다. 내 생각에 FBSDK 4.6은 iOS 9 시스템 FB 인증 자격 증명과 충돌합니다.

편집 됨 : 얼마간의 테스트 후에도 이전만큼 자주 발생하지는 않았지만 여전히 문제가되어 이전 버전의 FB SDK로 다운 그레이드했습니다. 누군가가 더 나은 해결책을 찾길 바랍니다.


FB 코드를 파헤 쳤는데 이것은 단순히 권한 문제인 것 같습니다.

FB uses the keychain to store an authorization challenge during login. When returning it attempts to get the value from the keychain and fails. See this SO answer for more info.

Security entitlements can change between provisioning profiles, and as we all know, keeping our profiles and build configurations and devices/sims straight is like herding cats. This could explain why people experience such inconsistent behavior.

So it might be safe to assume that in a production environment, everything will work fine, and if things aren't working during testing then you need to double-check the entitlements on your provisioning profiles.


In my case it was fixed by updating to latest FB SDK. 4.10 at the moment.


I fixed the problem by uninstalling the app and re-installing and it worked right away.

The error is probably related to iOS 9. Since iOS 9, I think the SDK uses SafariViewController and it seems to create issues when you are already logged.


I was getting the same error on xcode 7.1 ios 9.1 FB SDK 4.7.1. .

Uninstalling, installing and testing without xcode works fine for the first time. This will allow you to plug back in the device and run it at least a couple of times (it seems to be a bit inconsistent...)


Same problem FB SDK 4.5.1 and none of the above solutions worked for me. I solved this by adding Bolts framework to project by drag & drop (from FacebookSDK directory)
and then adding bolts framework to appDelegate

    #import <bolts/bolts.h>

In the FBSDKDelegate Method loginButtonWillLogin put this

- (BOOL) loginButtonWillLogin:(FBSDKLoginButton *)loginButton{
[FBSDKAccessToken setCurrentAccessToken:nil];
return YES;}

Updating to the latest (4.11) FB SDK fixed this for me as well. Don't forget to clean your project after updating to see if it works for you!


I was able to get login working again on iOS9 with SDK 4.6.0 by adding the new plist key/value

<key>FacebookDisplayName</key>
<string>{Your App Name}</string>

Source code.

I also took the steps in some other answers here to implement a shared FBSDKLoginManager() instance.


To Resolve this issue you needs to just enable "Keychain Sharing" in capabilities.


I followed Suraj Pathak with Xcode 9.4.1 and Swift 4.2

  1. Add to AppDelegate didFinishLaunchingWithOptions

    SDKApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions)
    
  2. Add to AppDelegate delegate function

    func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
        return SDKApplicationDelegate.shared.application(app, open: url, options: options)
    }
    
  3. Allow Keychain in Capabilities.


If you are using FBSDK 4.38 there is a bug with the parsing of challengeExpected in FBSDKLoginManager.m.

I found a hot fix of rinat-enikeev for it:

https://github.com/facebook/facebook-sdk-swift/issues/286

https://github.com/facebook/facebook-objc-sdk/pull/922/commits/bcf7f787e92320a6322fb3f6130fdc3815bbafb7

그냥 바꿔

NSString *challengeExpected = [self loadExpectedChallenge];

...에

NSString *challengeExpected = [[self loadExpectedChallenge] stringByReplacingOccurrencesOfString:@"+" withString:@" "];

그것은 나를 위해 문제를 해결했습니다.

참고 URL : https://stackoverflow.com/questions/30678712/fbsdk-login-error-code-308-in-objective-c

반응형