HTH,

It worked! I can't begin to thank you enough!

Sincerely,

Israel

On 15/03/2011, at 12:55, hax0rsteve wrote:

> 
> 
> Israel,
> 
> Assuming that everything else is correct (I have no experience with GData)
> your post body should be something more like this : 
> 
> NSString *requestBody = @"status=somestatus";
> 
> Noting that the part after the '=' will need to be URL encoded as
> per the docs : http://dev.twitter.com/pages/auth#auth-request
> 
> Otherwise twitter will not know what you are trying to do.
> 
> You should also probably do the following rather than using NSASCII :
> 
> [request setHTTPBody:[requestBody dataUsingEncoding:NSUTF8StringEncoding]]
> 
> 
> HTH
> 
> 
> On 15 Mar 2011, at 19:17, Israel Pasos wrote:
> 
>> This is my first time with GData and I'm trying to use it with OAuth
>> to connect to Twitter and post status updates.
>> 
>> Here's what I did:
>> 
>> 1. I'm able to login using Gdata and OAuth to Twitter.
>> 2. I save [mAuth token] in NSUserDefaults.
>> 3. I changed the URL and set the HTTPMethod to POST in my app's
>> mainViewController:
>> 
>> NSString *urlStr;
>> if ([self isGoogleSegmentSelected]) {
>>  // Google Contacts feed
>>  urlStr = @"http://www.google.com/m8/feeds/contacts/default/thin";;
>> } else {
>>  // Twitter update status
>>    urlStr = @"https://api.twitter.com/1/statuses/update.xml";;
>> }
>> 
>> NSURL *url = [NSURL URLWithString:urlStr];
>> NSMutableURLRequest *request = [NSMutableURLRequest
>> requestWithURL:url];
>>  [request setHTTPMethod:@"POST"];
>>  [mAuth authorizeRequest:request];
>> 
>> 
>> 
>> The only thing I'm missing is how to add the status parameter to the
>> request. I have no idea how to do this. Could anyone help me?
>> 
>> 
>> 
>> 2011-03-15 10:51:32.793 OAuthSampleiPhone[73515:207] API response: <?
>> xml version="1.0" encoding="UTF-8"?>
>> <hash>
>> <request>/1/statuses/update.xml</request>
>> <error>Client must provide a 'status' parameter with a value.</
>> error>
>> </hash>
>> 
>> 
>> I have tried this:
>> 
>> NSMutableURLRequest *request = [NSMutableURLRequest
>> requestWithURL:url];
>>   [request setHTTPMethod:@"POST"];
>>   NSString *requestBody = @"Request!";
>>   //[request setValue:@"application/x-www-form-urlencoded"
>> forHTTPHeaderField:@"Content-Type"];
>>   [request setHTTPBody:[requestBody
>> dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]];
>>   //[request setValue:[NSString stringWithFormat:@"%d",[requestBody
>> length]] forHTTPHeaderField:@"Content-Length"];
>>   [mAuth authorizeRequest:request];
>> 
>> But I get this error:
>> 
>> 2011-03-15 11:40:42.023 OAuthSampleiPhone[74083:207] API response: <?
>> xml version="1.0" encoding="UTF-8"?>
>> <hash>
>> <request>/1/statuses/update.xml</request>
>> <error>Incorrect signature</error>
>> </hash>
>> 
>> 
>> Thanks in advance,
>> 
>> Israel
>> 
>> -- 
>> Twitter developer documentation and resources: http://dev.twitter.com/doc
>> API updates via Twitter: http://twitter.com/twitterapi
>> Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
>> Change your membership to this group: 
>> http://groups.google.com/group/twitter-development-talk
> 

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

Reply via email to