Check if application Already installed

Hi,

i'm tring to make private store application like Appstore to put on it our internal applications that we developing.

now i'm facing an issue with checking if the user download spisfic app from my private store or not to let my private store check if it's not installed, make it install, and if it's installed let it open.


i tried to put in info.plist URL Schema. but the problem here when in check in my code. it's make the check on info.plist. means if the code found the name in URL Schema, it will undersood it installed. even if the user didnt install it.

So please advise me with this issue. i need to check if the appliction not installed let the app install it and if it installed let the app open it


Thanks for your highly support

Ahmad Taalab

Accepted Reply

Finaly Alhamdo lelah, i got the soultion. And i'll share it here to be referance.


in the orginal app "Appstore" in info.plist i putted LSApplicationQueriesSchemes<Array> and under it i putted uniq name like "MyApp1", "MyApp2" and so on...


and in the another app will be in this app "needed to be download from my Appstore" in info.plist also i putted 'URL Type' under it added URL Shcema and gived it one of my uniq ID "MyApp1"


and in my code i jsut added cuples of code lines

            let url = "server url"
            let endPointURL = NSURL(string: url)
            let appURLScheme = "MyApp1://"
          
            guard let appURL = URL(string: appURLScheme) else {
                return
            }
          
            if UIApplication.shared.canOpenURL(appURL)
            {
              
                if #available(iOS 10.0, *) {
                    UIApplication.shared.open(appURL)
                }
                else {
                    UIApplication.shared.openURL(appURL)
                }
            }
            else {
                /
                print("Application is not installed")
                UIApplication.shared.openURL(endPointURL! as URL)
              
              
            }

and it's worked fine

Thanks for every one interested to my question

Replies

Something I don't understand:

- do you want to do the check on server side or on device side ?

- if on device, is it an app that controls which otrher apps heve bneen loaded ?

- if you check on device from inside the app to be downloaded, that supposes that the app has been loaded !

What platform are you talking about? macOS or iOS?


If it's macOS, you should identify apps by their bundle ID, and use the methods in the NSWorkspace class to find or open an app with a known bundle ID.

i need to chenk on device side

YES, it's like app store app have a lot of applications and user can download anyone of them.

i already can check if application already installed or not, and in my appstore app i can let download button to open button. my issue if the user delete the application. how can my appstore app know this app is deleted to change the open button to download again???

What platform are you talking about? macOS or iOS?

I’d like to know the answer to this too. The tags on the original post included “ios”, so I’m going to presume that answer.

@A.Taalab, You’re going to have a very hard time making this work. That’s not surprising given what the developer program legal agreement has to say about creating your own store front. Are you intending to distribute this app via the App Store? If so, I’d stop now and re-read the legal agreements under which you’re operating. Or are you building this for an enterprise environment? If so, the right answer is probably to talk to your MDM server to manage app installation.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

just keep it simple. when the app installs, store a locked file with a secure/encrypted hash in a shared location.

Finaly Alhamdo lelah, i got the soultion. And i'll share it here to be referance.


in the orginal app "Appstore" in info.plist i putted LSApplicationQueriesSchemes<Array> and under it i putted uniq name like "MyApp1", "MyApp2" and so on...


and in the another app will be in this app "needed to be download from my Appstore" in info.plist also i putted 'URL Type' under it added URL Shcema and gived it one of my uniq ID "MyApp1"


and in my code i jsut added cuples of code lines

            let url = "server url"
            let endPointURL = NSURL(string: url)
            let appURLScheme = "MyApp1://"
          
            guard let appURL = URL(string: appURLScheme) else {
                return
            }
          
            if UIApplication.shared.canOpenURL(appURL)
            {
              
                if #available(iOS 10.0, *) {
                    UIApplication.shared.open(appURL)
                }
                else {
                    UIApplication.shared.openURL(appURL)
                }
            }
            else {
                /
                print("Application is not installed")
                UIApplication.shared.openURL(endPointURL! as URL)
              
              
            }

and it's worked fine

Thanks for every one interested to my question