I am making an iPhone application where you can submit your score to Twitter to share it (as a status update) currently using this code:
NSString *twitterURL = [NSString stringWithFormat:@"http://twitter.com/?status=My%20score%%20is:%%20%i%%20and%%20CharsPerMin%%20is:%%20%@", currentScore, charPerMin.text];
[[UIApplication sharedApplication] openURL: [NSURL URLWithString: twitterURL]];
And that URL works fine, but only if you're logged in. So I think this is more of a Twitter URL issue. Does anyone know how to make it so when the user is prompted to login they will see the Tweet they're about to send. (If you're not logged in and you go to the
http://twitter.com?status=statusHere URL, once you do login the tweet "statusHere" disappears.
How would I make it so it works if the user is logged in or not?
In order to post to a twitter user feed the user needs to be logged in. There is no way around this.
A good HIG (Human Interface Guideline) would be to prompt the user to log in with their Twitter credentials if they have not already done so. Preferable at the time of the score update to their Twitter status, or even allow the user to save their credentials as a setting so it's done automatically without user intervention.
Check the MGTwitterEngine that Matt Legend Gemmell has created. Should provide you with what you will need in order to properly post to a Twitter user status.
Here are few tutorials on how to implement the MGTwitterEngine
Hope this information helps. If you have further questions, or need additional help please drop a note.