I assume that your URL encoding is wrong in the OAuth code. Make sure that you use %20 for a space and not +. The standard NSString URLencode function won't really work.

Code that has always worked for me to URLencode (got it from the web somewhere, sorry for not mentioning the original author) :
+(NSString*)urlEncode:(NSString*)str {
    return [(NSString *)CFURLCreateStringByAddingPercentEscapes(
(CFStringRef)@"!*'();:@&=+$,/?%#[]", kCFStringEncodingUTF8 ) autorelease];



On 5/28/11 1:25 PM, Ayman Adel wrote:
I am building a twitter client for the IPhone and I'm using OAuth to
authenticate my requests to twitter,

Right now I am able to get the home time line and even post tweets
( that do not contain any spaces or symbols) the problem starts when I
try to post a tweet that contains spaces for example it gives me :
{"error":"Incorrect signature","request":"\/1\/statuses\/update.json"}

For example the tweet : "ThisIsATweet" works, but the tweet : "this is
a tweet" doesn't work here's my http request body code:


NSData* body =[NSString stringWithFormat:@"status=%@",[self

[request setValue:@"application/x-www-form-urlencoded"
[request setValue:[NSString stringWithFormat:@"%d",[body length]]

[request setHTTPBody:[body


Twitter developer documentation and resources: https://dev.twitter.com/doc
API updates via Twitter: https://twitter.com/twitterapi
Issues/Enhancements Tracker: https://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 

Reply via email to