hello,
I am writing an application in Objective-C whose functionality is to call and execute another application.Pls can i know the procedure???Let me also know where i need to keep the calling application which has to load and execute???
hello,
I am writing an application in Objective-C whose functionality is to call and execute another application.Pls can i know the procedure???Let me also know where i need to keep the calling application which has to load and execute???
I'm not sure I fully understand your question, but if all you're trying to do is launch another app, there are a number of ways to do this. The most straightforward is probably by using the NSTask class. Here is a simple example of launching iCal from within an Objective-C application using an NSTask.
NSTask *task = [[NSTask alloc] init];
[task setLaunchPath:@"/Applications/iCal.app/Contents/MacOS/iCal"];
[task launch];
[task release];
It is worth noting at this point that you are unlikely to be able to launch another application on the iPhone; the best you can do is probably detaching to another app; and even that might be nontrivial. (On the iPhone, 3rd party/userland applications cannot live in the background.)
The only way to "launch" another application is if the other application "cooperates" with yours, if you will.
The cooperation comes in the form of a URL protocol scheme that an application exposes. Examples are mailto: (exposed by the system mail application) and sms: (exposed by the Messages app).
http://wiki.akosma.com/IPhone%5FURL%5FSchemes seems to have a comprehensive list of third party apps exposing a custom protocol scheme that you can make use of.
Launching another app is a matter of calling [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"twitterrific://..."];
(for example).
As of OS 3.0 you can also check if a given URL protocol scheme is available via UIApplication's -canOpenURL:
— checking if some app has registered the protocol scheme, or in other words checking if an application is installed.
If you are writing both apps yourself then launching a custom protocol scheme is pretty simple, however you can't launch an arbitrary iPhone app, and you wouldn't be able to enumerate available apps anyway because of the sandbox.