Tag Archives: UIApplication

How to open a URL in Safari programmatically

Instead of loading a URL into a UIWebView we can also launch Safari to display it:

The method returns a BOOL value which will feed back if this operation was a success or not:

openURL can open phone numbers (tel:), mailto: links, http: and https: links.

How to link to an iOS App

Direct web link to your app or developer account showing all your apps:

Direct link to a country specific app store (say Germany in this exampe):

If your app name contains spaces replace them with dashes. Replace http with imts to avoid Safari redirects on iOS devices. The http links will send web users to a page which asks to open iTunes on their machines.

To link from Objective-C so that the app store app opens automatically:

Alternatively you can use Apple’s Link Maker Tool: http://itunes.apple.com/linkmaker/ – this lets you create buttons like the one below as well as direct links to web pages that look like iTunes:

Poirot for iOS - Pinkstone Pictures Ltd.