我想發推文,但我不想使用撰寫推文。iOS發送帶織物的推文,無需撰寫推文
TWTRComposer *composer = [[TWTRComposer alloc] init];
[composer setText:@"just setting up my Fabric"];
[composer setImage:[UIImage imageNamed:@"fabric"]];
[composer showWithCompletion:^(TWTRComposerResult result) {
if (result == TWTRComposerResultCancelled) {
NSLog(@"Tweet composition cancelled");
}
else {
NSLog(@"Sending Tweet!");
}
}];
https://dev.twitter.com/twitter-kit/ios/compose這種方法顯示一些彈出屏幕,我想送鳴叫一瞬間,我怎麼能做到這一點與面料API?這種類型是可能的?
這部分代碼不能與面料做工
ACAccountStore *accountStore = [[ACAccountStore alloc] init];
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:@"https://upload.twitter.com/1/statuses/update_with_media.json"] parameters:[NSDictionary dictionaryWithObject:self.textViewOutlet.text forKey:@"status"] requestMethod:TWRequestMethodPOST];
[postRequest addMultiPartData:UIImagePNGRepresentation(image) withName:@"media" type:@"multipart/png"];
[postRequest setAccount:twitterAccount];
[postRequest performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error)
{
//show status after done
NSString *output = [NSString stringWithFormat:@"HTTP response status: %i", [urlResponse statusCode]];
NSLog(@"Twiter post status : %@", output);
}];
}
}
}];
你試過上面的代碼我正在使用,但我越來越Domain = STTwitterTwitterErrorDomain代碼= 220「您的憑據不允許訪問此資源。」 UserInfo = 0x7ff4bb5a2720 {NSLocalizedDescription =您的憑據不允許訪問此資源。,NSUnderlyingError = 0x7ff4bb598c10「HTTP狀態403:禁止」 – RameshIos 2015-03-18 09:15:46
您必須先獲得許可 – 2015-03-23 12:06:05
如何獲取權限?我啓用了允許此應用程序用於使用Twitter登錄並更改權限讀取,寫入和訪問直接消息。 – RameshIos 2015-03-24 05:33:55