Ios 不使用tweetcomposeviewcontroller发送Tweet
我想直接从iPhone应用程序发送推文,而不显示TWTweetComposeViewController弹出窗口 我还想得到所有的追随者 有没有办法在ios5上的twitter框架中实现这一点,或者我应该使用另一个api 如果我必须使用另一个api,你能为我指定一个很棒的api吗?因为我找到的所有API 互联网是如此古老Ios 不使用tweetcomposeviewcontroller发送Tweet,ios,xcode,ios5,twitter,Ios,Xcode,Ios5,Twitter,我想直接从iPhone应用程序发送推文,而不显示TWTweetComposeViewController弹出窗口 我还想得到所有的追随者 有没有办法在ios5上的twitter框架中实现这一点,或者我应该使用另一个api 如果我必须使用另一个api,你能为我指定一个很棒的api吗?因为我找到的所有API 互联网是如此古老 提前感谢有很多选择: 好吧,在iOS 6上,有苹果社交框架,你可以使用SLComposeViewController发布到Twitter、Facebook和新浪微博,以下是。T
提前感谢有很多选择: 好吧,在iOS 6上,有苹果社交框架,你可以使用SLComposeViewController发布到Twitter、Facebook和新浪微博,以下是。TWTweetComposeViewController已被弃用,运行iOS 6的设备将必须运行向后兼容性-因此请避免这种情况 不过,我一般不推荐它,因为它凌乱而臃肿。最后是。。。创建使用者密钥和密钥 我能想到的就这些
Rohan.有很多选择: 好吧,在iOS 6上,有苹果社交框架,你可以使用SLComposeViewController发布到Twitter、Facebook和新浪微博,以下是。TWTweetComposeViewController已被弃用,运行iOS 6的设备将必须运行向后兼容性-因此请避免这种情况 不过,我一般不推荐它,因为它凌乱而臃肿。最后是。。。创建使用者密钥和密钥 我能想到的就这些 Rohan。如果您使用的是iOS 5.0及更高版本,您可以使用TWRequest以编程方式从我的应用程序发布推文。发布tweet非常简单,不需要外部框架或任何东西 你需要进口。您从iPhone帐户存储中检索twitter帐户,您可以检查是否有多个帐户,然后使用该帐户发布请求 下面是一个发布带有图像的tweet的方法示例
- (void)shareTwitterImage:(UIImage *)image
{
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);
}];
}
}
}];
}
如果您使用的是iOS 5.0及更高版本,您可以使用TWRequest以编程方式从我的应用程序发布推文。发布tweet非常简单,不需要外部框架或任何东西
你需要进口。您从iPhone帐户存储中检索twitter帐户,您可以检查是否有多个帐户,然后使用该帐户发布请求
下面是一个发布带有图像的tweet的方法示例
- (void)shareTwitterImage:(UIImage *)image
{
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);
}];
}
}
}];
}
如果您计划通过Twitter集成TwitterKit,通过自定义Twitter应用程序执行推文,那么这可能会对您有所帮助 使用相同的方法,您可以使用以下API获取追随者列表
希望有帮助。如果您计划通过Twitter集成TwitterKit,通过自定义Twitter应用程序执行推文,那么这可能会对您有所帮助 使用相同的方法,您可以使用以下API获取追随者列表 希望能有帮助