views:

76

answers:

1

Hi I Have tried

NSString *alertTxt =textfieldName.text; NSLog(@"Name: %@",alertTxt); NSURL *urlAddress = [[NSURL alloc ] initWithString: @"%@/login/index.php",alertTxt];

error : too many argument to function initstring ..

the user will giv the url address to the alertText field and i hav to embed in to the webkit may i know the process how to make it !!!

Where im making mistake kindly help me out in this

Thanks

A: 

-initWithString: can only take a complete string, not a format string. To use -initWithString: you need to complete the string first.

NSString* urlString = [NSString stringWithFormat:@"%@/login/index.php", alertTxt];
NSURL* urlAddress = [[NSURL alloc] initWithString:urlString];

BTW, it may be more efficient to use -stringByAppendingString:.

NSString* urlString = [alertTxt stringByAppendingString:@"/login/index.php"];
KennyTM
Thanks for your response Kenny i have solved the issue by stringWithFormat.
siva