Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iphone sdk-预期的标识符错误_Iphone_Xcode_Nsurl - Fatal编程技术网

iphone sdk-预期的标识符错误

iphone sdk-预期的标识符错误,iphone,xcode,nsurl,Iphone,Xcode,Nsurl,我正在尝试加载一个url,其中输入字段的值添加到url的末尾,并且该url错误为“expected identitifer”:( 我做错了什么?你错过了括号 [self fetchURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://localhost/test/script.php?name=%@&",[[urlField text]]]]]; 或者试试看 NSString *urlString = [NSS

我正在尝试加载一个url,其中输入字段的值添加到url的末尾,并且该url错误为“expected identitifer”:(


我做错了什么?

你错过了括号

[self fetchURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://localhost/test/script.php?name=%@&",[[urlField text]]]]];
或者试试看

    NSString *urlString = [NSString stringWithFormat:@"http://localhost/test/script.php?name=%@&",[urlField text]];
    NSURL *url = [NSURL URLWithString:urlString];
    [self fetchURL:url];

根据以下内容编辑,现在出现错误:“发生连接故障。操作无法完成。连接被拒绝。”如果您仍然对此感到困扰,请将其作为单独的问题发布。
    NSString *urlString = [NSString stringWithFormat:@"http://localhost/test/script.php?name=%@&",[urlField text]];
    NSURL *url = [NSURL URLWithString:urlString];
    [self fetchURL:url];