Andres
Andres

Reputation: 11757

Share a link on Tumblr from iOS app

I've been googling around to find a way to share a link in tumbler... I just found sharekit to do this, and I really don't like it... What other options do you think I have for this?

I can't believe there are no libraries to achieve this in a relatively easy way...

Any idea?

Thanks!

Upvotes: 2

Views: 3004

Answers (2)

Andres
Andres

Reputation: 11757

Just found this!

TMTumblrSDK

It works fine! To make a text post you just have to:

NSDictionary *parameters = [[NSDictionary alloc] initWithObjectsAndKeys:
                                    @"Titulo",@"title",
                                    @"Este es el body",@"body",nil];

[[TMAPIClient sharedInstance] post:@"blogName" type:@"text" parameters:parameters callback:^(id var, NSError *error){
     NSLog(@"Error %@",error);        
}];

I hope it helps someone!

Upvotes: 4

user2236389
user2236389

Reputation: 126

If you don't mind them leaving the app, you can create a URL of the format:

NSURL *url = [NSURL URLWithString:@"http://tumblr.com/share?s=&v=3&t=[Title]&u=[URL]"];
[[UIApplication sharedApplication] openURL:url];

which will open a tumblr window in Safari with the [Title] and [URL] fields pre-populated. Or,

NSURL *url = [NSURL URLWithString:@"tumblr://text?title=[Title]&link?url=[URL]"];
[[UIApplication sharedApplication] openURL:url];

Which will do the same, but with the tumblr iOS app, if the user has it installed. If you want to stay in-app, you could make WebView which contains option #1.

Upvotes: 1

Related Questions