Hello, may I ask how to detect the other apps in use with xcode programming? For example, I need to run an app which could show what apps are running in the iphone or ipad.
Apple sandboxes everything, meaning you can't get info on other apps. Apple clearly has that information because they gather stats on what apps have been run and for how long. Unless you have a hook into the other apps, I really don't think you'll be able to get that information.
I could be wrong, but I'm pretty sure Apple doesn't allow that info.
If the apps you’re wanting to verify have a published URL schema, you can check if that’s available. That’s how apps know to route to an installed app (like Twitter), or to use some external default through Safari.
Do something like this using the canOpenURL method to check if there’s an app that can handle that URL/schema, then you can openURL:[] and invoke the native app, or handle the lack of the app, like so:
Code:
NSString *url = @“custom_url_schema://";
if ([[UIApplication sharedApplication] canOpenURL:[NSURL url]]) {
// open and route with custom url
} else {
// handle lack of schema, open in safari, notify user, etc.
}
This of course doesn’t detect “running” apps, and only apps with a published schema, but since I don’t know your actual design goals, I figured I’d toss it out there as a possible solution.