2016-10-13 2 views
0

Ich habe ein Problem mit Twitter-Login auf iOS. Wenn das Benutzerkonto in Anwendung Einstellungen gesetzt hat, erhalte ich folgende Fehlermeldung:Einloggen mit Twitter auf iOS

[TwitterKit] did encounter error with message "User's system account credentials are invalid.": Error Domain=TWTRLogInErrorDomain Code=7 "The system account credentials are no longer valid and will need to be updated in the Settings app." UserInfo={NSLocalizedDescription=The system account credentials are no longer valid and will need to be updated in the Settings app., NSLocalizedRecoverySuggestion=The user has been prompted to visit the Settings app.}

Und die Anmeldeinformationen gültig sind, ich doppelt so überprüfen. Wenn in der App "Einstellungen" kein Konto vorhanden ist, wird meine Anmeldung wie erwartet ausgeführt. Die Methode, die ich nennen ist:

Twitter.sharedInstance().logInWithCompletion {(session, error) -> Void in 
+0

Sie FHSTwitterEngine für twitter Login –

+0

@Jecky dank nutzen können. Ich habe es mit anderen Methoden gelöst. – Nemanja

Antwort

0

mein Problem gelöst, indem Methode:

Twitter.sharedInstance().logInWithMethods(TWTRLoginMethod.WebBased, completion: {(session, error) -> Void in 

Aber denken Sie noch andere Methode sollte auch funktionieren.

1

Ich denke, die folgende Methode sollte auch funktionieren.

Twitter.sharedInstance().logIn(withCompletion: {(session: TWTRSession, error: Error) -> Void in 
    if session { 
     print("@\(session.userName()) logged in! (\(session.userID()))") 
    } 
    else { 
     print("error: \(error!.localizedDescription)") 
    } 
}) 

It takes the account credentials from the Settings Twitter app.

Mehr schauen: - AppDelegate.m

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]) -> Bool { 
    //Twitter 
    Twitter.sharedInstance().start(with: kTwitterConsumerKey, consumerSecret: kTwitterConsumerSecret) 
    Fabric.with([Twitter.sharedInstance()]) 
    return true 
} 
  • Info.plist

enter image description here

+0

Dies funktioniert nicht für mich, es ist das gleiche wie in meiner Frage. – Nemanja

+0

Ja, es scheint so zu sein, aber es funktioniert gut mit den SDKs, die mit 'Fabric' installiert sind. Wie haben Sie die Twitter-Frameworks hinzugefügt? –

+0

Ja, ich habe twitterkit und fabric kit mit Pods hinzugefügt und twitter settings eingestellt, getestet mit plist und programmatisch. – Nemanja

0
Twitter.sharedInstance().logIn { session, error in 
     if (session != nil) 
     { 
      print("signed in as \(session!.userName)"); 
      let client = TWTRAPIClient.withCurrentUser() 
      let request = client.urlRequest(withMethod: "GET", 
       url: "https://api.twitter.com/1.1/account/verify_credentials.json", 
       parameters: ["include_email": "true", "skip_status": "true"], 
       error: nil) 
      client.sendTwitterRequest(request) 
      { response, data, connectionError in 
       print(response) 
      } 
     } 
     else 
     { 
      print("error: \(error!.localizedDescription)"); 
     } 
     } 
    } 

das hilft mir in swift3

Verwandte Themen