Twitter integration and iOS5: semantic and parsing issues

Posted by Tyler on Stack Overflow See other posts from Stack Overflow or by Tyler
Published on 2011-12-01T01:44:38Z Indexed on 2011/12/01 1:50 UTC
Read the original article Hit count: 573

Filed under:
|
|
|
|

I was using some of Apple's example code to write the Twitter integration for my app.

However, I get a whopping amount of errors (mostly being Semantic and parse errors).

How can this be solved?

  -(IBAction)TWButton:(id)sender {
ACAccountStore *accountstore = [[ACAccountStore alloc] init];
//Make sure to retrive twitter accounts
ACAccountType *accountType = [accountstore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];
[accountstore requestAccessToAccountsWithType:accountType withCompletionHandler:^(BOOL granted, NSError *error) {
    if (granted) [{
        NSArray *accountsArray = [accountstore accountsWithAccountType:accountType];
    if ([accountsArray count] > 0) {
 ACAccount *twitterAccount = [accountsArray objectAtIndex:0];

            TWRequest *postRequest = [[TWRequest alloc] initWithURL:[NSURL URLWithString:@"http://api.twitter.com/1/statuses/update.json"]  parameters:[NSDictionary dictionaryWithObject:[@"Tweeted from iBrowser" forKey:@"status"] requestMethod:TWRequestMethodPOST];

            [postRequest setAccount:twitterAccount];

            [postRequest preformRequestWithHandeler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) {
                NSString *output = [NSString stringWithFormat:@"HTTP response status: %i", [urlResponse statusCode]];
                [self preformSelectorOnMainThread:@selector(displaytext:) withObject:output waitUntilDone:NO];
            }];

        }
    }];
}
 //Now lets see if we can actually tweet

 -(void)canTweetStatus {
     if ([TWTweetComposeViewController canSendTweet]) {
         self.TWButton.enabled = YES
         self.TWButton.alpha = 1.0f;
     }else{
         self.TWButton.enabled = NO
         self.TWButton.alpha = 0.5f;
     }



}

enter image description here

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about ios