Ios Twitter Kit 1.10.1 - TWTRLogInButton responds with -1012 error


Approximately 50% of our users receive a -1012 error when the following Twitter Kit API 1.10.1 code is executed in our application:

    var btn = TWTRLogInButton(logInCompletion: { session, error in
       if session != nil && error == nil {
       } else {
          ...-1012 error reported...

Users can resolve this error by removing all twitter accounts in iOS Settings > Twitter and logging into our app again.

Is this resolved in version 1.11.0? The changelog indicated resolution of some network issues. Though, this feels more like an expired oAuth token or something corrupted in the Accounts Framework.

We are unable to replicate.


Getting the same. No idea how to reproduce, but it’s happening on my own personal account.


This is still a problem in 1.11.0, again only for some users. It seems that old/invalid twitter accounts are languishing in the Accounts Framework.


Yep hitting this too. It’s something about system Twitter accounts setup previously (perhaps before iOS9). The only fix i can see is to have the users

a) remove access to your app in Settings > Twitter


b) remove / readd their twitter account

From the Farbric docs:

The SDK first attempts to leverage system Twitter accounts, via Accounts.framework. If that fails, it falls back to presenting an OAuth flow. After successful authentication, the SDK automatically saves the account to iOS system accounts and the TWTRSession will contain a token, secret, username, and user ID of the user. If authentication fails, the error will be non-nil.

So many moving parts there. Of course it’s not going to work. I blame Accounts.framework.

There really should be a flag that skips the whole system Twitter all together and just pops the OAuth flow. The oauth flow works perfectly every time.

I’ve never used the Accounts.frameworks and not run into issues like this.

I’m gonna try TwitterKit 1.11.3, we’ll see what happens.


Problem persisting in 1.11.3. Gonna try it on iOS 9.0.2 as well (which was just released).

Any insight from team Twitter on this one? @niall @andypiper ?



Neither of us are specialists in this piece, so we will need to ask one of the Fabric team to comment. I’m not aware of any change here.

Can't login via Twitter Kit for iOS

Thanks, @andypiper


We’re looking into this, and will update the thread when we have news. Thanks for the report!


Super, lemme know if/how I can help.


Hi @keighl,

Could you clarify if the account is was stored in iOS8 and then 1012 issue happened after upgrading to iOS9 or you were already on iOS9?


@kang, we first detected this issue with users running iOS8 with pre-existing twitter accounts, they had not yet upgraded to iOS9, I don’t think it is related to iOS9


the same issue - iOS 8.4 and Twitter 1.11.4


Thanks for the data points; we are actively looking into it!


Hey @kang, I believe our test users were already on iOS9


@man_derson Do you happen to have access to any of the logs for the users that this is happening to? Specifically, I am curious if there is a line that looks something like “Cancelling API request, SSL certificate is invalid”. The -1012 error code usually corresponds to cancelling an auth challenge and the presence of this log line will help us narrow down the problem.



Unfortunately I do not have any logs (apart from the error code), and have not been able to replicate with any internal devices. I will add some additional logging as part of our next release.


One of our users trying to login with twitter today saw the same error in the production app. I can’t replicate this locally. The TiwitterKit framework in our production is version 1.11.3.


Response from method loginWithCompletion… if (!session){ NSLog(@"[%@,%@,%@,%@]",[error localizedDescription],[error localizedFailureReason],[error userInfo], [error localizedRecoverySuggestion]); }

[The operation couldn’t be completed. (NSURLErrorDomain error -1012.),(null),{
NSErrorFailingURLKey = “”;
NSErrorFailingURLStringKey = “”;
NSUnderlyingError = “Error Domain=kCFErrorDomainCFNetwork Code=-1012 “The operation couldn\U2019t be completed. (kCFErrorDomainCFNetwork error -1012.)” UserInfo=0x1586a100 {_kCFURLErrorAuthFailedResponseKey=<CFURLResponse 0x14532410 [0x32c048d0]>{url =}}”;

Please tell me that is everithing I should log? I can add something to log and paste response here.


@mackode are you able to consistently reproduce this error? If so, can you let us know how you are reproducing it. Also, are there any other messages showing up in your console around the time you get this error?


Any updates here? I’m seeing this issue on iOS 8.1 and twitter kit version 1.11.4 on some of my test user’s devices. I cannot reproduce it internally though.