ios - 如何打开 Pinterest 和 Linked iOS 应用程序以分享内容?

标签 ios post share linkedin pinterest

我正在编写一个 iOS 应用程序,它需要打开 Pinterest 和 LinkedIn 才能分享一些东西。 (如果用户没有安装它,它将打开 safari 并分享 - 发布一些东西)。

我尝试使用一些 Schemes,但没有用。也许无论如何都要这样做。

我找到了一些与 Pinterest 应用程序共享的 URL 方案。它对我有用:

NSString *sharingURL = [[NSString stringWithFormat:@"pinterestsdk.v1://pinit/?client_id=%@&source_url=%@&image_url=%@&app_name=%@&suggested_board_name=%@&description=%@",@"xxxxxxx", @"shareurl.com", @"shareurl.com/shareMedia.png", @"Your_App_Name", @"Board_Name", @"Your_Description"] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

if([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:sharingURL]])
{
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:sharingURL]];
}

通过 LinkedIn,我正在研究最佳解决方案。

哦,也许有办法与 LinkedIn 应用程序共享,当您在 Safari 浏览器上按共享时,它有一个用于 LinkedIn 的选项,并且它无需登录(safari 之前没有登录 LinkedIn,只是 LinkedIn 应用程序。)。但是LinkedIn的SDK只支持REST API。

谢谢,抱歉我的英语不好。

最佳答案

Opening a Pinterest User Profile

- (IBAction)openPinterestUser:(id)sender {

    // open the Pinterest App if available
    if (![[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"pinterest://user/juliav1"]]) {

        // opening the app didn't work - let's open Safari
        if (![[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.pinterest.com/versluis2000/"]]) {

            // nothing works - perhaps we're not online
            NSLog(@"Dang!");
        }
    }
}

Opening a Pinterest Board

- (IBAction)openPinterestBoard:(id)sender {

    // open the Pinterest App if available
    if (![[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"pinterest://board/versluis2000/ios-projects"]]) {

        // opening the app didn't work - let's open Safari
        if (![[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.pinterest.com/versluis2000/ios-projects/"]]) {

            // nothing works - perhaps we're not online
            NSLog(@"Dang!");
        }
    }
}

Opening a Pinterest Pin

- (IBAction)openPinterestPin:(id)sender {

    // open the Pinterest App if available
    if (![[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"pinterest://pin/76279787413881109"]]) {

        // opening the app didn't work - let's open Safari
        if (![[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.pinterest.com/pin/76279787413881109/"]]) {

            // nothing works - perhaps we're not online
            NSLog(@"Dang!");
        }
    }
}

使用 Pintrest SDK

Pin methods

- (void)getPinWithIdentifier:(NSString *)pinId
                      fields:(NSSet *)fields
                 withSuccess:(PDKClientSuccess)successBlock
                  andFailure:(PDKClientFailure)failureBlock;

- (void)createPinWithImageURL:(NSURL *)imageURL
                         link:(NSURL *)link
                      onBoard:(NSString *)boardId
                  description:(NSString *)pinDescription
                  withSuccess:(PDKClientSuccess)successBlock
                   andFailure:(PDKClientFailure)failureBlock;

- (void)createPinWithImage:(UIImage *)image
                      link:(NSURL *)link
                   onBoard:(NSString *)boardId
               description:(NSString *)pinDescription
                  progress:(PDKPinUploadProgress)progressBlock
               withSuccess:(PDKClientSuccess)successBlock
                andFailure:(PDKClientFailure)failureBlock;

这是 Pintrest IOS SDK 链接 pinterest/ios-pdk

1: https://github.com/pinterest/ios-pdk

适用于 iOS 的 PinterestSDK 将允许您对 Pinterest 帐户进行身份验证,并代表经过身份验证的用户发出请求。有关支持端点的详细信息,visit the Pinterest API .

关于ios - 如何打开 Pinterest 和 Linked iOS 应用程序以分享内容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32152865/

相关文章:

ios - 我可以在 iCloud 上共享 CoreData 吗?

ios - 如果是编辑风格,请重新设计 Tableview Cell

Java:从后端向不同网站发送POST请求

Java "Broken Pipe"错误(使用 Unirest http 包装器)

java - 新用户创建通知邮件不会在 Alfresco 中发送

ios - 导航栏只有在滚动时才有背景

ios - iOS上传JSON文档时需要检测app无法连接服务器的情况

java - 如何从 XPages (java) 中的 POST 检索参数

ios - 使用适用于 iOS 的 SDK 在 Linkedin 上分享不起作用

parsing - 共享迭代器