在Pinterest上共享图像从包中获取无效的url格式

时间:2014-03-29 06:54:46

标签: ios pinterest

获取“错误无效参数'source_url'(值/var/mobile/Applications/DB373DAD-8D47-.....A5/PintItDemo.app/shareImage.png)不是有效的网址格式。”

我只是想在Pinterest上从我的设备中固定图像。所以我刚刚从NSBundle中检索了图像的网址以获取资源并通过以下路径

NSString* stringURL = [[NSBundle mainBundle]pathForResource:@"imageToPin" ofType:@"png"];
[_pinterest createPinWithImageURL:[NSURL URLWithString:stringURL]
                           sourceURL:[NSURL URLWithString:stringURL]
                         description:@"Pinning from my app"];

1 个答案:

答案 0 :(得分:-1)

如错误所示,您的网址/var/mobile/Applications/DB373DAD-8D47-.....A5/PintItDemo.app/shareImage.png不是有效网址。显然,因为它始于/var/mo... 请尝试使用以下有效网址:

  

https://www.xyz.com/var/mobile/Applications/DB373DAD-8D47-A5/PintItDemo.app/shareImage.png

修改
要使Pinterest 'Pin it' button起作用,需要有一个普遍可访问的图像网址,可以将其传递给“它”。链接href属性。
因此,您可以将图像上传到服务器并创建一个可以传递给“它”的网址。按钮。

A' Pin it'按钮只是一个静态链接。可能有一种方法可以使用Pinterest API将图像上传到Pinterest,然后共享相同的图像。但那将完全不同。