When I write this:
NSLog("Text Value %@",statutsField.text);
It work fine , but when I do this:
NSURL *url = [NSURL URLWithString:@"http://MyUrl/%@",statutsField.text];
I get an error:
too many argument to method call, expected …
Please help.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
URLWithString:only accepts one argument; one singleNSString. You are passing it two, the string@"http://MyUrl/%@"and the string instatutsField.text.You need to construct a combined version of the string, and pass that combined version to
URLWithString:. Use+[NSString stringWithFormat:]for this:The function
NSLogaccepts a variable number of arguments, based on the number of format specifiers that it finds in its first string (the format string); this is why yourNSLogcall works. The methodstringWithFormat:works similarly. For each%@it finds in its first argument, it takes an object from the rest of the argument list and puts it into the resulting string.For details, you can see Formatting String Objects in the String Programming Guide.