Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
this is my code textbox1 is the NStextfeild

C#
NSString *searchURL = [NSString stringWithFormat:@"https://www.google.com.au/webhp?sourceid=chrome-instant&ion=1&ie=UTF-8#hl=en&safe=off&tbo=d&sclient=psy-ab&q=", [_textbox1 stringValue]];


and this is my error
<br />
data argument is not used for format string<br />


ive searched all around the web for this and basically I only get information on xcode 4 and lower, which is useless because wee up to xcode 6 now for ios 6.1

so basically I have a button where this code is connected to, i press the button and it goes to the google site + whatever you typed in the textbox

sounds simple, its not, can some one please help me with this? and please don't tell me to go learn the basics of xcode programming, because I only learn from making small projects like this.
Posted

1 solution

See the NSString +stringWithFormat: documentation.

In particular, look at the "Formatting String Objects" examples and the "String Format Specifiers" documentation.

You either need to change your format string to:

NSString *searchURL = [NSString stringWithFormat:@"https://www.google.com.au/webhp?sourceid=chrome-instant&ion=1&ie=UTF-8#hl=en&safe=off&tbo=d&sclient=psy-ab&q=%@", [_textbox1 stringValue]];


Or you could just say:

NSString *searchURL = @"https://www.google.com.au/webhp?sourceid=chrome-instant&ion=1&ie=UTF-8#hl=en&safe=off&tbo=d&sclient=psy-ab&q=";

searchURL = [searchURL stringByAppendingString: [_textbox1 stringValue]];
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900