Twitter integration with ios 5


Is there any login sheet for user that not yet registered their account?..




There are no UI elements in the Twitter framework except the Tweet Sheet (TWTweetComposeViewController). The Twitter login UI is in the device’s Settings application.

The recommended approach:
You can check if the user is already logged in via a call to +[TWTweetComposeViewController canSendTweet]. If this call returns false, the system will instruct the user to go to and enter credentials when you call -[ACAccountStore requestAccessToAccountsWithType:]. In Settings, the user can signup or enter his or her credentials but unfortunately, the user is not redirected back to your app after logging in. As such, you may want to message the user to let them know to return once they have added an account.

It is still possible to create your own login sheet and then create the ACAccount instance for the user, but you will need to design and implement the login screen.


Sean, is it possible to make a TWRequest without using credentials saved in ACAccount? I have my application with key, secret key, ecc., but I don’t want to save credential in a Twitter Account under “”.


I can’t sign in to my Twitter account in iOS 5 simulator (Xcode 4.3.1). After verifying it shows the error message “The user name or password is incorrect”. And I see this in the console:

12.02.12 2:07:53,777 twitterd: New ACAccountAuthenticator connection
12.02.12 2:07:54,979 twitterd: Error: The operation couldn’t be completed. (NSURLErrorDomain error -1012.)

How can I solve this problem? Thank you.


Were you able to get this issue resolved? If not, please try to reset the simulator and then re-add your Twitter credentials.


This does not work. I have tried on iOS 5.0 & iOS 5.1 simulators. Resetting them both and changing the region/time zone with no luck. The error i get is “The username or password is incorrect”. The system console shows “Preferences: unexpected error on accountauthentication connection”


I encountered the same problem and was able to resolve it by syncing my OS X date and time settings back with Apple’s servers and restarting the simulator. I had changed it earlier to simulate a different time in the app.


It is still possible to create your own login sheet and then create the ACAccount instance for the user, but you will need to design and implement the login screen.

How can I set username ,password ?


Hey Sean,
You say “the system will instruct the user to go to” where / when does it do that? I wish it did, but I can’t get it to…
Are there any code examples of the Add Account section within the Twitter app?


I’m still seeing this issue (running Mountain Lion 10.8 and using Xcode 4.4 4F243). I never had this issue using Xcode 4.3.3 on Lion 10.7.

I have tried to “Reset Content and Settings…” from the iOS Simulator (I’ve used both version 5.0 and 5.1 for iPhone and iPad), but I still get the error “Error Signing In - The user name or password is incorrect”. I’ve also tried turning off OS X date and time setting and back on to use Apple’s time servers and restarting the iOS Simulator.


  1. Run iOS Simulator (using Hardware Device iPhone, Version 5.1 9B176)
  2. Go to Settings / Twitter and enter my user name and password (the same combination works in Safari and I can successfully log in to
  3. Click the Sign In button

I still get “Error Signing In - The user name or password is incorrect”.

Got any other other suggestions or solutions?


I’m not sure if Mountain Lion may be the culprit here–or just a red herring–but I’d recommend trying to reset your simulator’s local state and seeing if that helps to clear out whatever the problem may be. I do that using bash script below. NOTE: THIS WILL ERASE ALL OF YOUR LOCAL SIMULATOR DATA.

Are you able to login via on a physical device?

Anything on your network in your network configuration that may be affecting the SSL connection from the simulator? Anything proxying the traffic?

# Resets all local iOS Simulator states. Use at your own risk. #!/bin/bash rm -rf ~/Library/Application\ Support/iPhone\ Simulator/*/Applications/*/{Documents,Library,tmp} rm -rf ~/Library/Application\ Support/iPhone\ Simulator/*/Library/{Caches,Preferences}


I am also having the same issue with Signing in on the simulator, Running Mountain Lion GM with Xcode 4.4 GM. Tried doing a fresh install of OS X and a fresh download of Xcode and no difference. I ran your script and its still returning: “Error Signing In - The user name or password is incorrect”.

The Console says:

7/16/12 10:39:43.602 AM Preferences[2236]: Unexpected error on AccountAuthentication connection

I never had this issue in 10.7 with Xcode 4.3


I reset my simulator’s local state per your script, ran the app in the iPhone 5.1 Simulator, and still get the same issue “Error Signing In - The user name or password is incorrect” when attempting to Sign In in the Simulator

I am able to sign in via on any physical device.

Nothing in my network configuration was changed (unless Mountain Lion installation changes these), and I don’t have any proxies enabled.

I think it’s time to hit up the Apple folks in the Developer Forums…

Thank you Sean.


en français please


Same issue here. Just installed Mountain Lion GM and XCode 4.4 GM. Can’t login to twitter with the iOS simulator.


Oddly enough I installed the Beta version of XCode and can only log into Twitter on the iOS 6 emulator…this is really weird…


Yes - I also can use Xcode 4.5-DP3 and iOS 6 Simulator and it works to login to Twitter using the


Just as a heads up, the new version of XCode release to the general public today has the exact same issue. Something seems to be broken with the iOS 5.X SDK in ML from what I figure


fwiw, I’m seeing this as well: Mountain Lion + Xcode 4.4 + iPhone simulator + Twitter = :frowning: