开发者

Beginner xcode/iphone webservices question

I aspire to create a button on my iPhone app, that when clicked, pings www.mysite.com/webInfo.php and receives a response.

My current programming skills extend 开发者_JS百科to switching views and making pictures appear, and I'm not sure how to do this in a way that doesn't require opening a browser window.

Thanks!


Read up on the documentation of NSURLResponse.

If you want to see what type of response you get, try getting the status code of the page.

Hope this helps, and good luck!

EDIT: Here's some example code:

NSURLRequest *request=[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.stackoverflow.com/"] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:30];

NSURLConnection *connection=[[NSURLConnection alloc] initWithRequest:request delegate:self];

if(connection){
    //response
}else{
    //no response
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜