Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/114.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iOS-如果我发送“Pinterest共享说明文字,则说明文字不起作用”&&引用;在描述文本中_Ios_Objective C_Pinterest - Fatal编程技术网

iOS-如果我发送“Pinterest共享说明文字,则说明文字不起作用”&&引用;在描述文本中

iOS-如果我发送“Pinterest共享说明文字,则说明文字不起作用”&&引用;在描述文本中,ios,objective-c,pinterest,Ios,Objective C,Pinterest,我也在我的应用程序中实现了pinterest共享代码。工作正常。但问题出现在一个场景中,请参见下文 正确工作: [pinterest createPinWithImageURL:[NSURL URLWithString:imageUrl] sourceURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",shareUrl]] description:@"My Description"]; 然后,它将按照我的期望共享

我也在我的应用程序中实现了pinterest共享代码。工作正常。但问题出现在一个场景中,请参见下文

正确工作

[pinterest createPinWithImageURL:[NSURL URLWithString:imageUrl]
    sourceURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",shareUrl]] 
    description:@"My Description"];
然后,它将按照我的期望共享与我的描述相同的Pinterest描述

但是当我发送描述测试时就像:

[pinterest createPinWithImageURL:[NSURL URLWithString:imageUrl]
    sourceURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",shareUrl]] 
    description:@"My Details & Description"];
然后它将共享Pinterest描述,如我的详细信息。 我希望这里的文本是我的详细信息和描述这是符号后的字符串

我到底出了什么问题,请看这里。

好吧,Pinterest不是开源的,所以很难找出到底是怎么回事

然而,我猜这个方法是在后台创建一个GET请求,它错误地对
description
参数进行了URL编码(可能他们使用的是
stringByAddingPercentEscapesUsingEncoding
或其他一些简单的方法)

我建议联系Pinterest SDK开发人员/维护人员来调查这一点

作为一个快速解决方案,您可以自己尝试对
&
进行URL编码。例如,您可以尝试将
&
替换为
%26
,例如

NSString *description = // ...whatever it should be set to...
description = [description stringByReplacingOccurrencesOfString:@"&" withString:@"%26"];
但是,这实际上可能会导致其他问题,因为Pinterest SDK可能会进行某种URL编码,并且可能会对
%
符号进行编码

另一种简单的方法可能是将
&
替换为
,例如

NSString *description = // ...whatever it should be set to...
description = [description stringByReplacingOccurrencesOfString:@"&" withString:@"and"];

同样,这是一个黑客程序,但它是一个解决底层SDK中可能存在的错误的方法。

我希望在不使用第三方的情况下处理它。在“&”之后添加“%”,因此改为“我的详细信息和%Description”。我会尝试告诉您这是否可行……谢谢@Erion@Erion您的解决方案不起作用……我只是在下面使用了@JRG Developer的答案