I'm making an app that shows you the list of all apps you have installed, then when I select then, I want to launch that app in my device. I'm using the following code
- (IBAction)openapp:(NSString*)app
{
urlString = [[NSString alloc]initWithFormat:@"%@:",app.accessibilityLabel];//init string with app name and append it to ":"
[urlString stringByReplacingOccurrencesOfString:@" "withString:@""];//remove all spaces
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];//open URL with scheme
}
It work in some cases that the scheme is the same as the name of the app, but sometimes it fails because it isn't (example - facebook scheme = fb). So, I need to get the scheme of the app from somewhere. Also I can't just create a NSString and alloc a fixed scheme there because the app I'll be opening will change from device to device. Anyone can help me with that?