Search code examples
iosobjective-ciphonemobile-website

iPhone App: Launch My App on My Website and Tips


I hope this is not asked before, I've searched and not sure those are the answers that I want (iPhone apps: Can I open an app from a link in a website? and Apple URL Schemes). Plus I haven't developed my website yet either, so I'll probably need some tips for that too.

My goal is to develop a website AND an iphone app that can eventually connect together. For example, something like Yelp or YouTube: you can go to their website on phone and they will tell you that either you can download their app or you can launch their app from there. Also IF they launch the app, the app will be displaying whatever they were looking at (maybe the same page, etc.)

So my questions are:

1) Can you give me suggestions regarding the development flow? (App first or website first, framework, etc.)

2) How do you actually connect them and make your app to go to the correct view?

Thanks a ton!


Solution

  • 1) Can you give me suggestions regarding the development flow? (App first or website first, framework, etc.)

    I recommend you start with what you do best, so you're more productive. Unfortunately I have no site hint to give you, sorry.

    2) How do you actually connect them and make your app to go to the correct view?

    You can use this for open any website:

    NSURL * URLMyWebSite = [NSURL URLWithString:@"http://www.google.com"];
    [[UIApplication sharedApplication] openURL:URLMyWebSite];
    

    For open your app, you need enable URL Scheme, only add URL Type into plist:

    enter image description here

    After this, you can open your app:

    <a href="myfirstApp://">Open My First App</a>
    

    And you can send parameter:

    <a href="myfirstApp://login?username=rondinellimorais&password=1234">Open My First App</a>
    

    Use HelperLibrary for parse query string into NSDictionary.

    Other app can open your app:

    NSURL * URLMyFirstApp = [NSURL URLWithString:@"myfirstApp://login?username=rondinellimorais&password=1234"];
        if([[UIApplication sharedApplication] canOpenURL:URLMyFirstApp]){
            [[UIApplication sharedApplication] openURL:URLMyFirstApp];
        }