2016-09-20 5 views
2

Facebook 로그인을 iOS 10 앱에 swift 3.0으로 통합하려고합니다.오류 코드 2500 Swift 3.0의 Facebook 로그인

오류 코드 콘솔 :

body =  { 
    error =   { 
     code = 2500; 
     "fbtrace_id" = FpAkfsaBAFc; 
     message = "An active access token must be used to query information about the current user."; 
     type = OAuthException; 
    }; 
}; 
code = 400; 
}}) 

loginButton 기능 loginViewController에 :

func loginButton(_ loginButton: FBSDKLoginButton!, didCompleteWith result: FBSDKLoginManagerLoginResult!, error: Error!) { 

    fetchProfile() 
    print("@@@@Completed [email protected]@@@") 

} 

내가는 FacebookSDK 응용 프로그램에 설치 한 후 아래 그림과 같이 오류 코드 2500을 받고 loginVC에서 Facebook 프로필 기능 가져 오기 :

,
func fetchProfile() { 


    let parameters = ["fields": "email, first_name, last_name, picture.type(large)"] 

    FBSDKGraphRequest(graphPath: "me", parameters: parameters).start(completionHandler: { (connection, user, requestError) -> Void in 

     if requestError != nil { 
      print(requestError) 
      print("There are some error during getting the request from fb") 
      return 
     } 

     self.email = (user?["email"] as? String)! 
     self.firstName = (user?["first_name"] as? String)! 
     self.lastName = (user?["last_name"] as? String)! 

     self.nameLabel.text = "\(self.firstName) \(self.lastName)" 
     print("My fbname is " + self.firstName) 
     print(self.lastName) 

     var pictureUrl = "" 

     if let picture = user?["picture"] as? NSDictionary, let data = picture["data"] as? NSDictionary, let url = data["url"] as? String { 
      pictureUrl = url 
      print(pictureUrl) 
     } 

    }) 
} 

AppDelegate.swift

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 
    // Override point for customization after application launch. 

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

    return true 
} 



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

비슷한 스택 오버 플로우에 대한 질문,하지만 빠른 3.0에서 작동하지 않는 검색은 사람이 문제, 감사에 대한 조언과 좋은를 가질 수 있다면 감사하겠습니다 더라면 일!

답변

1

은 내가 키 체인에서 기능를 공유 할 수 있도록 문제를 해결했고 페이스 북 로그인은 완벽하게 작동합니다!

1

오류 메시지가 표시되면 access_token이 누락되었습니다. 요청하기 전에 컨트롤을 만들고 access_token이 nil인지 확인한 다음 새로운 요청을 요청하십시오. 그 후에는 요청을 할 수 있어야합니다. 키 체인 접근이 iOS10에서 기본적으로 비활성화되었습니다로

+1

감사합니다. – aznelite89

관련 문제