Tagged: UIApplication Toggle Comment Threads | Keyboard Shortcuts

  • Jay Versluis 12:54 am on January 11, 2013 Permalink | Reply
    Tags: openURL, , UIApplication   

    Categories: iOS ( 222 )   

    How to open a URL in Safari programmatically 

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

        UIApplication *mySafari = [UIApplication sharedApplication];
        NSURL *myURL = [[NSURL alloc]initWithString:@"http://www.mydomain.com";
        [mySafari openURL:myURL];

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

    if (![mySafari openURL:myURL])
    {
    //  opening didn't work
    }

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





     
  • Jay Versluis 1:02 pm on August 17, 2012 Permalink | Reply
    Tags: App Store, UIApplication   

    Categories: iOS ( 222 )   

    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:

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"itms://itunes.com/apps/myappname"]];
    

    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.





     
c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel