Pregunta

Apache CouchDB requiere la clave para ser encerrado por comillas dobles:". Sin embargo, cuando escapado a los rendimientos resultantes NSURL (null) cuando se registra en la consola y la respuesta resultante (null), así, obviamente

Aquí está el código:

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

También he intentado usar% 22 en lugar de las comillas dobles que no funcionaba bien.

¿Cómo puedo añadir con éxito las comillas dobles en la solicitud de URL?

¿Fue útil?

Solución

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 :)

Otros consejos

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).

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top