开发者

Launch browser from my application

I want to launch safari browser from my IOS app with an specific url whe开发者_如何学Cn I press a button.

Is that possible?


[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.google.com"]];


Use this code for launching the URL in the Safari Browser,

NSString* url = @"http://example.com";

UIApplication* app = [UIApplication sharedApplication];
[app openURL:[NSURL URLWithString:url]];


Sure you can!

Use the - (BOOL)openURL:(NSURL *)url method of UIApplication. You can get an instance of UIApplication using the static method + sharedApplication.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜