【问题标题】:How to open Pinterest and Linked iOS app for share something?如何打开 Pinterest 和 Linked iOS 应用程序进行分享?
【发布时间】:2015-08-22 05:54:57
【问题描述】:

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

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

我找到了一些与 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。

谢谢,对不起我的英语不好。

【问题讨论】:

    标签: ios post share linkedin pinterest


    【解决方案1】:

    打开 Pinterest 用户个人资料

    - (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!");
            }
        }
    }
    

    开设 Pinterest 板

    - (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!");
            }
        }
    }
    

    打开 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

    固定方法

    - (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。

    【讨论】:

    • 它可以重定向以创建包含某些内容的 Pin 图吗?
    • 截至 2013 年 5 月 20 日,Pinterest 已发布用于固定内容的 iOS SDK。查看他们的开发者网站了解更多信息。 developers.pinterest.com
    • 欲了解更多信息,您可以在这里获取表格.. developers.pinterest.com/docs/sdks/ios
    • @Ninh,我已经编辑了我的代码,检查一下,如果你觉得有帮助,请点赞我的回答
    • 谢谢,我试试看。
    【解决方案2】:

    与上面提到的 Pinterest SDK 答案类似,LinkedIn 提供了一个本地 iOS SDK,这将有助于通过它共享内容。

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

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

    【讨论】:

    • 我试过了,但也许它只支持通过 REST API 共享。我正在寻找打开他们的 ios 应用程序并填写一些可以分享的内容,例如 Pinterest。使用LinkedIn URL Schemes(和SDK),我找到了一些可以打开个人资料的Deeplink,但没有什么可分享的。
    • 您可以使用 SDK 中的 REST 辅助方法发送 API 调用以共享内容。再看developer.linkedin.com/docs/share-on-linkedin在页面中间点击“iOS SDK”标签,有一个完整的Objective-C提供的分享示例。
    猜你喜欢
    • 2014-10-07
    • 2017-02-21
    • 1970-01-01
    • 1970-01-01
    • 2015-08-16
    • 1970-01-01
    • 1970-01-01
    • 2021-03-24
    • 1970-01-01
    相关资源
    最近更新 更多