Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open application with bundle identifier

Is it possible to open a application from our application with bundle identifier. Suppose I have two apps installed on device one with com.test.app1 and com.test.app2. Can I open app1 from my app2.

I know about openUrl method. for that I have to register url scheme in info.plist. and then i can use following method:

[[UIApplication sharedApplication] openUrl:[NSURL urlWithString:@"myApp1://"]];

But what if I didn't register url scheme or don't know the registered url.

Any idea..?

like image 925
Kapil Choubisa Avatar asked Aug 29 '11 11:08

Kapil Choubisa


People also ask

What is the bundle identifier?

A bundle ID or bundle identifier is a unique identifier of an app in Apple's ecosystem. It means that no two apps can have the same bundle ID. A bundle identifier lets macOS recognize any updates to your app. It is used in validating the application signature.

How do I get a bundle identifier?

Open you project with XCode, select the top project item in the project navigator at the left. Then select TARGETS -> General. Bundle Identifier is found under Identity.

What is difference between app ID and bundle ID?

Bundle ID is the identifier of an App, but App ID is not. App ID is the connection between App and provisioning profile. From "About Bundle IDs" section in here, you can see, "A bundle ID precisely identifies a single app".


1 Answers

You can use private API to do that

Class LSApplicationWorkspace_class = objc_getClass("LSApplicationWorkspace");
NSObject * workspace = [LSApplicationWorkspace_class performSelector:@selector(defaultWorkspace)];
BOOL isopen = [workspace performSelector:@selector(openApplicationWithBundleID:) withObject:@"com.apple.mobilesafari"];
like image 93
Evan JIANG Avatar answered Oct 06 '22 19:10

Evan JIANG