Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

chikiuso

macrumors newbie
Original poster
Apr 24, 2014
2
0
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.
 

1458279

Suspended
May 1, 2010
1,601
1,521
California
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.
 

chikiuso

macrumors newbie
Original poster
Apr 24, 2014
2
0
Thanks for your info, you are right, I just would like to make sure, thanks.
 

D.T.

macrumors G4
Sep 15, 2011
11,050
12,460
Vilano Beach, FL
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.

For example:

fb://
twitter://
imdb://

Most are here:

http://wiki.akosma.com/IPhone_URL_Schemes

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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.