我编写了一个iOS应用程序,它需要打开Pinterest和LinkedIn才能共享。 (如果用户未安装,则将其打开并共享-发布内容)。
我尝试使用一些方案,但是没有用。也许无论如何都可以做到这一点。
我找到了一些与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浏览器上按Share时,它有一个LinkedIn选项,并且它无需登录即可工作(Safari之前没有登录LinkedIn,只是LinkedIn应用程序。)。但是LinkedIn的SDK仅支持REST API。
谢谢,抱歉我的英语不好。
最佳答案
打开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的详细信息。
关于ios - 如何打开Pinterest和Linked iOS应用共享内容?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/32152865/