gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-29 10:26:11 24 4
gpt4 key购买 nike

我正在编写一个 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com