How do I send multiple querystring parameters in ios?
Here is my code
Passing parameters to my Querystring gives me Bad Access Error!
NSString *myJson = @"http://mySite.com/Service.svc/MyList"开发者_如何转开发;
myJson = [myJson stringByAppendingFormat:@"?id=%@&uid=%@", firstId, secondId];
Can someone help me out!
What you do here is simple string formatting.
Given what you are doing, I guess firstId & secondId are integers, not objects, so your error is because you don't use the right format.
The format %@
in you stringByAppendingFormat
is for displaying an object, or more precisely the string returned by its description
selector.
If you want to format an integer, just use %d
as in C :)
This will give you :
NSString *myJson = @"http://mySite.com/Service.svc/MyList";
myJson = [myJson stringByAppendingFormat:@"?id=%d&uid=%d", firstId, secondId];
精彩评论