我使用了UserName = raj和pwd = space,但该url字符串在NSURL中没有使用。
NSString *urlstr = [NSString stringWithFormat:@"http://www.test.com/data/image/sd.php?Uname=raj&password=Space"];
NSURL *Url = [NSURL URLWithString:urlstr];
答案 0 :(得分:0)
试试这个: -
NSString *urlstr = [NSString stringWithFormat:@"http://www.test.com/data/image/sd.php?Uname=raj&password=Space"];
NSURL *url = [[NSURL alloc] initWithString:
[urlstr stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]];
答案 1 :(得分:0)
NSURL *url = [NSURL URLWithString:@"http://www.test.com/data/image/sd.php?Uname=raj&password=Space"];
答案 2 :(得分:0)
如果您从textfield获取值,请尝试以下操作:
NSString *urlstr = [NSString stringWithFormat:@"http://www.test.com/data/image/sd.php?Uname=%@&password=%@",[usernameField.text stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding],[passwordField.text stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]];