Reputation: 856
I had implemented pinterest sharing code in my app as well. Its working fine. But problem arrives at one scenario see follow
Correct working:
[pinterest createPinWithImageURL:[NSURL URLWithString:imageUrl]
sourceURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",shareUrl]]
description:@"My Description"];
Then it will share Pinterest Description same My Description as per my expectation.
But when I send Description Test like :
[pinterest createPinWithImageURL:[NSURL URLWithString:imageUrl]
sourceURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",shareUrl]]
description:@"My Details & Description"];
Then it will share Pinterest Description like My Details. My expected text here is My Details & Description this is trunks my string after & symbol.
What actually wrong happening with me please look at here.
Upvotes: 0
Views: 296
Reputation: 12663
AFAIK, Pinterest's Pin It SDK isn't open source, so it's difficult to find out what's really going on.
I would guess, however, that this method is creating a GET request under-the-hood that's incorrectly URL encoding the description
parameter (perhaps they're using stringByAddingPercentEscapesUsingEncoding
or some other naive method).
I'd recommend contacting the Pinterest SDK developers/maintainers to look into this.
As a quick fix, you might try URL encoding the &
yourself. For example, you might try replacing &
with %26
, e.g.
NSString *description = // ...whatever it should be set to...
description = [description stringByReplacingOccurrencesOfString:@"&" withString:@"%26"];
However, this might actually lead to other problems as the Pinterest SDK is likely doing some sort of URL encoding and would likely encode the %
symbol.
Another naive approach may simply be to replace &
with the word and
, such as
NSString *description = // ...whatever it should be set to...
description = [description stringByReplacingOccurrencesOfString:@"&" withString:@"and"];
Again, it's hacky, but it's a workaround for a bug that's likely in the underlying SDK.
Upvotes: 2