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

How to open Pinterest and Linked iOS app for share something?

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

我尝试使用一些方案,但没有用。也许无论如何都可以这样做。

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

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 app分享,当你在Safari浏览器上按share时,它有LinkedIn的选项,并且无需登录(safari之前没有登录LinkedIn,只是LinkedIn app。) .但是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 link pinterest/ios-pdk

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

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

类似于上面提到的 Pinterest SDK 答案,LinkedIn 提供了一个本机 iOS SDK,可以通过它促进内容共享。

您可以在这里下载:https://developer.linkedin.com/downloads

此处提供额外文档:https://developer.linkedin.com/docs/share-on-linkedin