开发者

Launch browser from my application

开发者 https://www.devze.com 2023-02-09 22:48 出处:网络
I want to launch safari browser from my IOS app with an specific url whe开发者_如何学Cn I press a button.

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

精彩评论

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

关注公众号