开发者

iphone sdk - expected identifier error

i'm trying to load up a url with the value of the input field added to the end of the url and it errors with "expected identitifer" :(

[self fetchURL:[NSURL URLWithString:[NSString stringWithFormat开发者_StackOverflow社区:@"http://localhost/test/script.php?name=%@&",[[urlField text]]]];

what have I done wrong?


You have missed the bracket

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

OR try instead

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜