0

under the message is my code. But I have taken error message "Could not authenticate you"

how can I fix it ?

thank you

- (IBAction) sendButtonTapped: (id) sender {
    NSString* themessage = [NSString stringWithFormat:@" %@. I'm %@ and feeling %@ about it.",
                            notesField.text ? notesField.text :@"", 
                            [activities objectAtIndex:[tweetPicker selectedRowInComponent:0]],
                            [feelings objectAtIndex:[tweetPicker selectedRowInComponent:1]]];
    NSLog(@"Twett buttone tapped ");

    //TWITTER BLACK MAGIC
    NSMutableURLRequest *theRequest=[NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://user name:password@twitter.com/statuses/update.xml"]
                                                            cachePolicy:NSURLRequestUseProtocolCachePolicy
                                                        timeoutInterval:60.0];

    [theRequest setHTTPMethod:@"POST"];
    [theRequest setHTTPBody:[[NSString stringWithFormat:@"status=%@", themessage] dataUsingEncoding:NSASCIIStringEncoding]];
    NSURLResponse* response;
    NSError* error;
    NSData* result = [NSURLConnection sendSynchronousRequest:theRequest returningResponse:&response error:&error];
    NSLog(@"%@", [[[NSString alloc] initWithData:result encoding:NSASCIIStringEncoding] autorelease]);

    //END TWITTER BLACK MAGIC

}
1
  • Could you try to remove status parameter? In C# project, I remove status parameter and it works
    – Ha Doan
    Mar 20, 2013 at 11:50

1 Answer 1

0

To call twitter web service APIs you gotta use OAuth, read about it here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.