Question

Apache CouchDB requires the key to be enclosed by double quotes: ", however when escaped the resulting nsurl returns (null) when being logged to the console and the resulting response (null) as well, obviously.

Here's the code:

NSURL *url = [[NSURL alloc] initWithString:@"http://username:password@gcg.cloudant.com:5984/points/_design/user/_view/where?key=\"m0rph3v5\""];

I've also tried using %22 instead of the double quotes which didn't work either.

How can I succesfully add the double quotes in the request url?

Was it helpful?

Solution

Turns out it had to do with the stringWithFormat I used which tried to decypher %22 as a variable as well and thus screwing up the url.

Using a nsmutablestring and appending the key variable turned out to be working properly :)

OTHER TIPS

Using %22 works for me. I get a valid NSURL object using this line of code:

NSURL *url = [[NSURL alloc] initWithString:@"http://username:password@gcg.cloudant.com:5984/points/_design/user/_view/where?key=%22m0rph3v5%22"];

The strange thing is that this works without escaping the @ sign.
IIRC it should also be escaped (%40).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top