After a fair amount of debugging, I have found a way to reproduce this case, but still not 100% sure on a solution:
- Go to twitter applications in settings using the web
- Revoke access to the iOS app
- Navigate to twitter settings within the settings app on your iPhone & when clicking on your twitter account, ensure you’re notified that the password is incorrect.
- Attempt to login
Result: Error code -1012
Expected: Show the login with twitter screen
Now here’s an interesting thing – the phone believes that it is authorized to use the twitter credentials for the app so the twitter library assumes the password must be wrong (hence the -1012, or authorization header being incorrect), so this can be fixed by simply swiping the authorization to use the twitter credentials to “no” within settings. This forces the flow of the app to bring up the web authorization dialog.
I am still looking for a solution but if this gets the ball moving for anyone else, please respond with how you solved it!
EDIT:
This is using TwitterKit 1.12.0 (also reproduced on 1.11.4)