Ios5 通过iOS 5推特API制作最受欢迎的推特
我正在制作一个twitter客户端应用程序。客户端的一个要求也是将特定推文标记为应用程序中的最爱。我在这上面搜索了两天,但没有任何线索。。如果可以通过iOS5的twitter API在not上实现,任何一位plz都可以为我提供指导。如果是,那么如何使用Twitter和帐户框架:Ios5 通过iOS 5推特API制作最受欢迎的推特,ios5,twitter,Ios5,Twitter,我正在制作一个twitter客户端应用程序。客户端的一个要求也是将特定推文标记为应用程序中的最爱。我在这上面搜索了两天,但没有任何线索。。如果可以通过iOS5的twitter API在not上实现,任何一位plz都可以为我提供指导。如果是,那么如何使用Twitter和帐户框架: ACAccountStore *accountStore = [[ACAccountStore alloc] init]; ACAccountType *accountType = [accountStore acco
ACAccountStore *accountStore = [[ACAccountStore alloc] init];
ACAccountType *accountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];
[accountStore requestAccessToAccountsWithType:accountType withCompletionHandler:^(BOOL granted, NSError *error) {
if(granted) {
// Get the list of Twitter accounts.
NSArray *accountsArray = [accountStore accountsWithAccountType:accountType];
// For the sake of brevity, we'll assume there is only one Twitter account present.
// You would ideally ask the user which account they want to tweet from, if there is more than one Twitter account present.
if ([accountsArray count] > 0) {
// Grab the initial Twitter account to tweet from.
ACAccount *twitterAccount = [accountsArray objectAtIndex:0];
NSString* urlString = [NSString stringWithFormat:@"http://api.twitter.com/1/favorites/create/%d.json", tweetID];
TWRequest *postRequest = [[TWRequest alloc] initWithURL:[NSURL URLWithString:urlString]
parameters:nil
requestMethod:TWRequestMethodPOST];
[postRequest setAccount:twitterAccount];
[postRequest performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) {
NSString *output = [NSString stringWithFormat:@"HTTP response status: %i", [urlResponse statusCode]];
NSLog(@"%@", output);
}];
}
}
}];
}
还可以查看Twitter REST API文档: