こんにちは私はこのエラーを取得しておいてください。私はXcodeの8を使用してプログラミングする場合エラーは受け取っ:エラードメイン= com.facebook.sdk.coreコード= 8「(ヌル)」
Error recieved: Error Domain=com.facebook.sdk.core Code=8 "(null)"
私のプロジェクトが正常に動作し、 swift 3.しかし今、私はxcode 7.3.1とswift 2.3を使用するようにダウングレードしました。このエラーが発生します。以下は
私appdelegateファイルされる:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool {
let viewController = ViewController(nibName: nil, bundle: nil)
viewController.view.backgroundColor = UIColor.whiteColor()
let navController:UINavigationController = UINavigationController(rootViewController: viewController)
self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
self.window?.backgroundColor = UIColor.darkGrayColor()
self.window?.rootViewController = navController
self.window!.makeKeyAndVisible()
//facebook
FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)
//Google
var error: NSError?
GGLContext.sharedInstance().configureWithError(&error)
assert(error == nil, "Error Configuring google services \(error)")
GIDSignIn.sharedInstance().delegate = self
return true
}
func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool {
return GIDSignIn.sharedInstance().handleURL(url, sourceApplication: options[UIApplicationOpenURLOptionsSourceApplicationKey] as! String, annotation: options[UIApplicationOpenURLOptionsAnnotationKey])
}
func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {
return FBSDKApplicationDelegate.sharedInstance().application(application, openURL: url, sourceApplication: sourceApplication, annotation: annotation)
}
func signIn(signIn: GIDSignIn!, didSignInForUser user: GIDGoogleUser!, withError error: NSError!) {
if error != nil {
print ("Error sigining in: \(error.localizedDescription)")
return
}
}
SignInController.swiftファイル:
class SignInController: UIViewController, FBSDKLoginButtonDelegate, GIDSignInUIDelegate, GIDSignInDelegate {
//starts here
let fbButton:FBSDKLoginButton = {
let button = FBSDKLoginButton()
button.readPermissions = ["public_profile", "email", "user_friends"]
return button
}()
override func viewDidLoad() {
super.viewDidLoad()
self.title = "Sign In"
self.view.backgroundColor = UIColor.whiteColor()
if FBSDKAccessToken.currentAccessToken() == nil {
print("I got token: \(FBSDKAccessToken.currentAccessToken()?.tokenString)")
view.addSubview(fbButton)
fbButton.center = view.center
fbButton.delegate = self
self.fetchprofile()
}
else {
print("Dont have token")
self.view.addSubview(fbButton)
fbButton.center = self.view.center
fbButton.delegate = self
}
GIDSignIn.sharedInstance().uiDelegate = self
GIDSignIn.sharedInstance().delegate = self
let googleButton = GIDSignInButton(frame: CGRect(x: 30, y: 150, width: 100, height: 50))
view.addSubview(googleButton)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func loginButton(loginButton: FBSDKLoginButton!, didCompleteWithResult result: FBSDKLoginManagerLoginResult!, error: NSError!) {
if error != nil {
print(error.localizedDescription)
return
}
print("I'm in")
fetchprofile()
}
func fetchprofile() {
print("Getting profile")
print("FB version: \(FBSDKSettings.sdkVersion())")
print("Tokensssss: \(FBSDKAccessToken.currentAccessToken()?.tokenString)")
let parameters = ["fields": "email"]
let graphRequest:FBSDKGraphRequest = FBSDKGraphRequest(graphPath: "me", parameters: parameters, HTTPMethod: "GET")
graphRequest.startWithCompletionHandler { (connection, result, error) -> Void in
if error != nil {
print("Error recieved: \(error.debugDescription)")
return
}
guard let email = result["email"] as? String else {
return
}
print("Email: \(email)")
}
}
func loginButtonWillLogin(loginButton: FBSDKLoginButton!) -> Bool {
return true
}
func loginButtonDidLogOut(loginButton: FBSDKLoginButton!) {
print("Logged out")
}
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
self.view.endEditing(true)
}
}
エラー受信:
Error recieved: Error Domain=com.facebook.sdk.core Code=8 "(null)" UserInfo={com.facebook.sdk:FBSDKGraphRequestErrorCategoryKey=0, com.facebook.sdk:FBSDKGraphRequestErrorHTTPStatusCodeKey=400, com.facebook.sdk:FBSDKErrorDeveloperMessageKey=An active access token must be used to query information about the current user., com.facebook.sdk:FBSDKGraphRequestErrorGraphErrorCode=2500, com.facebook.sdk:FBSDKGraphRequestErrorParsedJSONResponseKey={
body = {
error = {
code = 2500;
"fbtrace_id" = CgykKyskOcd;
message = "An active access token must be used to query information about the current user.";
type = OAuthException;
};
};
code = 400;
}}
は、誰かが助けることができます。おかげ
ここでは、私の情報-のplistファイルです:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<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>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fb{{myFB-Id}}</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>com.googleusercontent.apps.99471515633-84bp5qjrl8jqf0drm10aucsrrepgta12</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>{{Bundler-id}}</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSApplicationCategoryType</key>
<string></string>
<key>FacebookAppID</key>
<string>{{myFB-id}}</string>
<key>FacebookDisplayName</key>
<string>{{myFB-displayName}}</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fb-messenger-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
</array>
<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>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
をこのコードを追加します。これのためのキーチェーン?あなたは私はあなたがキーチェーンどういう@Jecky完全facebookでログイン –
を追加しない場合は、キーチェーンを追加する必要がありますのログインFacebookのための理由は?はい、あなたが私にデモ –
であなたを導くことができるデモしたい場合は、 – user3497437