How can I connect iPhone and web service and get XML data?

前端 未结 4 1390
南笙
南笙 2020-12-04 05:58

I know how to connect to web server using an iPhone but now I have to connect the iPhone to a web service. I don\'t know how to do it and there is no demo or class available

4条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-04 06:31

    You can use these 2 lines which return the response of your HTTP request. You don't need any configuration. This code is usefull if you try to access a PHP scritp for example. After you just have to parse your result.

    NSURL *URL=[[NSURL alloc] initWithString:stringForURL];
    NSString *results = [[NSString alloc] initWithContentsOfURL :URL];
    

提交回复
热议问题