IOS5でTwitterにテキスト付きの画像を送信するにはTWrequestを使用してください
アップルの例、 ACAccountStore *account = [[ACAccountStore alloc] init];
ACAccountType *accountType = [accountaccountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];
// Request access from the user to access their Twitter account
[account requestAccessToAccountsWithType:accountType withCompletionHandler:^(BOOL granted, NSError *error)
{
// Did user allow us access?
if (granted == YES)
{
// Populate array with all available Twitter accounts
NSArray *arrayOfAccounts = [account accountsWithAccountType:accountType];
// Sanity check
if ([arrayOfAccounts count] > 0)
{
// Keep it simple, use the first account available
ACAccount *acct = [arrayOfAccounts objectAtIndex:0];
// Build a twitter request
TWRequest *postRequest = [[TWRequest alloc] initWithURL:
[NSURL URLWithString:@"http://api.twitter.com/1/statuses/update.json"]
parameters:[NSDictionary dictionaryWithObject:@"tweet goes here"
forKey:@"status"] requestMethod:TWRequestMethodPOST];
// Post the request
[postRequest setAccount:acct];
// Block handler to manage the response
[postRequest performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error)
{
NSLog(@"Twitter response, HTTP response: %i", [urlResponse statusCode]);
}];
のようにこのようなTWRequestを使って簡単にツイートを送信することができますが、http://api.twitter.com/1/statuses/update_with_media.jsonを何らかの方法で使用してtweet twitpicや別のサービスを介して行く。または、ツイートと一緒に画像を送信する別の方法はありますか?
ありがとう
最終コードはどのように見えますか? – Ali