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:@&quot;<a href="http://www.mydomain.com&quot;/" rel="nofollow">http://www.mydomain.com&quot;</a>;
        [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&#039;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:@&quot;itms://itunes.com/apps/myappname&quot;]];
    

    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