How to check if the application is installed or not in the iOS device?

I am making one iOS application. In this case, I have one module for the UITableView. In this UITableView, I show a list of application names. These names come from my server. These are my company apps. So, I do not know how many applications will come from the server. As soon as the user clicks on the UITableViewCell, I need to check if these applications are already installed on this device. If it is not installed, the user needs to go to the appstore using the link to the application in this application. I checked a few lessons. In this they said, using url schemes, we can make this script. But I don't have url schemes for these URLs because these applications come from the server. In addition, I tried to use the following methods

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

but nothing helped me. Can anyone understand this problem, if so, give your valuable advice.

+4
source share
4 answers

For each application in the list, you will need the URL scheme of the application , there is no other way to check if the application is installed.

I guess that the list form you will be in the server will be in JSON, for example:

{
   "name" : "My Cool APP",
   "scheme" :"mycoolapp:",
   "itunes": "http:///...../"
}

Then just do something like:

    if ([[UIApplication sharedApplication] canOpenURL:scheme]) {
        [[UIApplication sharedApplication]openURL:scheme];
    }
    else {
        [[UIApplication sharedApplication]openURL:itunesURL];
    }
+4
source

URL- . URL ( , ) , . , ( ).

, . , , - . , ( ).

+2

URL- , :

if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"myAppURLScheme://"]])
{
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"myAppURLScheme://"]];
}
else
{
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"App not installed on Device"  delegate:self cancelButtonTitle:@"OK" otherButtonTitles:@"Open link", nil];
    [alert show];
}

URL

0

All Articles