开发者

NSURL declaration /allocation showing error

I Have tried

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

error : too m开发者_运维问答any 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


-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"];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜