Share a link on Tumblr from iOS app

你离开我真会死。 提交于 2019-12-10 10:40:22

问题


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!


回答1:


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!




回答2:


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.



来源:https://stackoverflow.com/questions/15794798/share-a-link-on-tumblr-from-ios-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!