【问题标题】:How to Post image or Text in Tumblr iPhone [closed]如何在 Tumblr iPhone 中发布图像或文本 [关闭]
【发布时间】:2014-09-07 14:36:30
【问题描述】:

我正在 iPhone 中进行 Tumblr 集成,但无法登录

从以下网址下载了 SDK:- https://github.com/tumblr/TMTumblrSDK

现在我想在 tumblr 上上传图片

【问题讨论】:

  • 解决它,缩小你的问题范围,然后问你是否有任何问题。在这一点上,它对于一个问题来说太宽泛了(可以在教程中介绍)。
  • 我在 google bt 上搜索没有提供任何细节,这就是我上传问题的原因 bro
  • 我自己快速搜索了一下,这是我找到的有用链接stackoverflow.com/a/10217264/656600
  • 我已经使用 OAthConsumer 在这篇文章中检查过,但我想使用 TMTumblr SDK?两者是否相同
  • hytgbn.net/2012/02/… 请看这篇文章,非常有帮助

标签: ios


【解决方案1】:

如果您已经下载了 Tumbler SDK,那么在 Insice 示例文件夹中,您将看到名为“PhotoPostExample”的示例项目。

这包含以下代码。负责图片上传。

- (void)viewDidLoad {
    [super viewDidLoad];

    UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    [button setTitle:@"Post photo" forState:UIControlStateNormal];
    [button sizeToFit];
    [button addTarget:self action:@selector(postPhoto) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];

    // TODO: Fill in your keys and secrets

    [TMAPIClient sharedInstance].OAuthConsumerKey = @"";
    [TMAPIClient sharedInstance].OAuthConsumerSecret = @"";
    [TMAPIClient sharedInstance].OAuthToken = @"";
    [TMAPIClient sharedInstance].OAuthTokenSecret = @"";
}

- (void)postPhoto {
    // TODO: Fill in your blog name

    [[TMAPIClient sharedInstance] photo:@""
                          filePathArray:@[[[NSBundle mainBundle] pathForResource:@"blue" ofType:@"png"]]
                       contentTypeArray:@[@"image/png"]
                          fileNameArray:@[@"blue.png"]
                             parameters:@{@"caption" : @"Caption"}
                               callback:^(id response, NSError *error) {
                                   if (error)
                                       NSLog(@"Error posting to Tumblr");
                                   else
                                       NSLog(@"Posted to Tumblr");
                               }];
}

希望这会有所帮助,其他人。

【讨论】:

  • 当我们包含 Thumblr SDK 时会出现 TMAPIClient is not defined 的错误
  • @AhmadDurrani 你需要阅读文档:特别是github.com/tumblr/TMTumblrSDK#getting-started
  • 我包含这个 sdk bt 仍然给同样的问题兄弟
  • 并阅读他们的文档
  • 但它只适用于平台 5 现在请告诉我我能做什么?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-05-10
  • 1970-01-01
  • 2012-07-21
  • 1970-01-01
相关资源
最近更新 更多