开发者

iPhone - press button open URL?

1) user launch application 2) user press button 3) button loads 开发者_开发技巧http://domain.com/mypage/?item=123

How do you trigger http://domain.com/?item=123, without opening the actual page in the browser?


NSURLConnection is the answer.


Not 100% sure of what the question is, but you could use a UIWebView. Load that UIWebView in the app with the URL and you should be good to go.

Hope this helps!


NSString* str = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"http://domain.com/?item=123"] usedEncoding:NULL error:NULL]


I have used a UIWebView set to "hidden". It probably is not the most efficient way but if you normally use UIWebViews and Interface Builder then it is easy. You can also use the webview delegate methods to watch it.

On second thought - use the NSURL String method above but put it in a new thread.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜