I was sending few data(strings) to server via query string. Everything was going fine then one time suddenly program crashed. It was “bad url error”. I didn’t know what happened at that time. I thought i was hitting bad url so i checked it again but it was correct. I run my program again, it was running fine. I followed this again n again to replicate that crash. Then it crashed one time again, and i noticed that it crashed only when i was sending string with space between on query string like london olympics. The crash was genuine since you can’t expect query string to have any “space”. So solution was to encode my string with percent(%) escapes as you see in regular query strings. There is a simple built-in method to do this:

[myString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]

This will make you string something like this: london%20olympics