iPhone: Open a url Programmatically

前端 未结 4 716
情话喂你
情话喂你 2020-12-28 14:42

I am new to iPhone. I want to open an url in my application. How can I do this task? Please suggest me and provide some useful link.

4条回答
  •  一生所求
    2020-12-28 15:33

    Apparently the link given above is outdated. Here is the update link for the UIApplication class.

    The quick and simple code snippet is:

    // ObjC
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"http://www.google.com"]];
    
    // Swift
    UIApplication.shared.open(URL(string: "http://www.google.com")!, options: [:], completionHandler: nil)
    

提交回复
热议问题