我正在尝试使用内置的iOS 5 Twitter框架和TwitVid SDK将视频上传到twitter。
我正在采取的步骤:
1)使用TWRequest获取签名请求。
ACAccountStore *accountStore = [[ACAccountStore alloc] init];
[accountStore requestAccessToAccountsWithType:[accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter] withCompletionHandler:^(BOOL granted, NSError *error) {
if(error) {
[[[UIAlertView alloc] initWithTitle:@"Sorry!" message:[error description] delegate:nil cancelButtonTitle:@"Okay" otherButtonTitles: nil] show];
}
else if (granted) {
NSArray *arrayOfAccounts = [accountStore accountsWithAccountType:[accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter]];
if ([arrayOfAccounts count] > 0) {
ACAccount *account = [arrayOfAccounts objectAtIndex:0];
NSURL *spURL = [NSURL URLWithString:@"https://api.twitter.com/1/account/verify_credentials.json"];
TWRequest *twRequest = [[TWRequest alloc] initWithURL:spURL parameters:nil requestMethod:TWRequestMethodGET];
[twRequest setAccount:account];
NSURLRequest *signedURLRequest = [twRequest signedURLRequest];
2)创建TwitVid实例并触发上传请求
TwitVid *twitVid = [[TwitVid alloc] initWithSource:@"Test" delegate:self];
[twitVid uploadWithMediaFileAtPath:moviePath offset:0 message:@"Test Message" mediaID:nil playlistID:nil vidResponseParent:nil userTags:nil geoLatitude:nil geoLongitude:nil tags:nil categoryID:nil description:@"upload test" title:@"The title" xVerifyCredentialsAuthorization:[signedURLRequest valueForHTTPHeaderField:@"Authorization"] xAuthServiceProvider:[spURL absoluteString]];
我第一次这样做时,我从相应的委托方法中得到了一些错误,并认为这是一个签名问题(我的代码中有一些错误)。现在,无论我做什么,我都没有任何代理方法。它不发送数据,没有收到任何响应 - 没有。我无所适从。有什么想法吗?