0

AddThis SDK用于 facebook、twitter 和电子邮件共享,facebook 和电子邮件运行良好,而 Twitter 在从我的 Iphone 连接时出错。
我的模拟器做得很好,但 iphone twitter 没有连接,只是在控制台"Error!"
代码中显示一条消息:
[AddThisSDK setTwitterViaText:@"QuotesApp"];
[AddThisSDK shareURL:@"http://HazratAliQuotes.com" withService:@"twitter" title:string description:@"QuotesApp"];

4

2 回答 2

0

这是您的可选答案。在IOS 5 中有框架 Tweeter.Framework。添加此框架并导入,我使用它来上传图像(作为链接)和消息。可能对你有帮助。:)

导入“推特/推特.h”

和按钮点击..

- (void)postImageOnTweeterWall
{

if (imageView.image)
{
 
    NSLog(@"tweetbutton pressed called");
    // Create the view controller
    TWTweetComposeViewController *twitter = [[TWTweetComposeViewController alloc] init];

    // Optional: set an image, url and initial text
    [twitter addImage:[UIImage imageNamed:@"img1.jpeg"]];
    // [twitter addURL:[NSURL URLWithString:[NSString stringWithString:@"http://MobileDeveloperTips.com/"]]];
    [twitter setInitialText:@"Tweet from iOS 5 app using the Twitter framework."];

    // Show the controller
    [self presentModalViewController:twitter animated:YES];

    // Called when the tweet dialog has been closed
    twitter.completionHandler = ^(TWTweetComposeViewControllerResult result) 
    {
        NSString *title = @"Tweet Status";
        NSString *msg; 
    
        if (result == TWTweetComposeViewControllerResultCancelled)
        msg = @"Tweet compostion was canceled.";
        else if (result == TWTweetComposeViewControllerResultDone)
        msg = @"Tweet composition completed.";
    
        // Show alert to see how things went...
        UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title message:msg delegate:self cancelButtonTitle:@"Okay" otherButtonTitles:nil];
        [alertView show];
    
        // Dismiss the controller
        [self dismissModalViewControllerAnimated:YES];
    };
}
else
{   UIAlertView  *alertView = [[[UIAlertView alloc] initWithTitle:@"Tweeter" message:@"Select photo to Upload" 
                                                             delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] autorelease];
        
        [alertView show];
        
   
    
}

}

于 2012-07-02T11:16:42.667 回答
0

尝试此链接以在您的应用程序中为以前版本的 iOS 实现 Twitter

twitter 的 Previos API 被称为 MGTTwitter

对于 AddThis:

要使用启用 Twitter OAuth 的共享,您需要告诉库这样做,然后配置您的 Twitter 使用者密钥、使用者密码和回调 URL。

[AddThisSDK setTwitterAuthenticationMode:ATTwitterAuthenticationTypeOAuth];
[AddThisSDK setTwitterConsumerKey:@"yourconsumerkey"];
[AddThisSDK setTwitterConsumerSecret:@"yourconsumersecret"];
[AddThisSDK setTwitterCallBackURL:@"yourcallbackurl"];

以下是添加的新答案。

删除线[AddThisSDK setTwitterViaText:@"QuotesApp"];

添加行[AddThisSDK setTwitterAuthenticationMode:ATTwitterAuthenticationTypeOAuth];

并在按下 twitter 按钮时创建一个选择器并将以下代码添加为

[AddThisSDK shareURL:@"http://www.addthis.com"
             withService:@"twitter"
                   title:@"AddThis - The #1 Bookmarking & Sharing Service"
             description:@"AddThis is a free way to boost traffic back to your site by making it easier for visitors to share your content."];
于 2012-07-02T11:46:05.460 回答