Tom, thank you very much this solved the problem :)

On 29 May 2011 18:02, Tom van der Woerdt <i...@tvdw.eu> wrote:

> 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(
>                                                                NULL,
>
>  (CFStringRef)str,
>                                                                NULL,
>
>  (CFStringRef)@"!*'();:@&=+$,/?%#[]",
>
>  kCFStringEncodingUTF8 ) autorelease];
>
> }
>
> Tom
>
>
>
> 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:
>>
>> <code>
>>
>> NSData* body =[NSString stringWithFormat:@"status=%@",[self
>> percentageEncoding:tweet]];
>>
>> [request setValue:@"application/x-www-form-urlencoded"
>> forHTTPHeaderField:@"Content-Type"];
>> [request setValue:[NSString stringWithFormat:@"%d",[body length]]
>> forHTTPHeaderField:@"Content-Length"];
>>
>> [request setHTTPBody:[body
>> dataUsingEncoding:NSISOLatin1StringEncoding]];
>>
>> </code>
>>
>>
> --
> 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:
> https://groups.google.com/forum/#!forum/twitter-development-talk
>



-- 

*Best Regards,**
** Ayman Adel*

-- 
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: 
https://groups.google.com/forum/#!forum/twitter-development-talk

Reply via email to