problem passing url in iphone app
Am passing a parameter to url and the parameter has special characters like space.... Also i tried replacing space with +
but the app is crashing...... Am not getting the reason
this is开发者_Python百科 the URL : https://www.googleapis.com/shopping/search/v1/public/products?key=AIzaSyD0x-0JAexkHtyNv55u4_9zZNJGLn6h89s&cx=017576662512468239146:omuauf_lfve&country=US&q=***%@***&startIndex=%d&maxResults=%d&alt=atom
,
and the parameter is like sony camera
Am not getting the reason
Please help me with this issue.
Thaks in advance..
You should pass three parameters with types NSString,int,int . I think wrong type of your parameters causing the crash. Try this method
NSString *urlString = [NSString stringWithFormat:YOUR_URL,parameter1, parameter2, parameter3];
NSURL *url = [NSURL URLWithString:urlString];
NSURL
will return nil
if the URL passed to it is not valid. What constitues a valid URL is as follows:
NSURL objects understand URLs as specified in RFCs 1808, 1738, and 2732.
In short, you'll probably need to escape your URL.
精彩评论