Reputation: 95
I have two apps, the first app calculate information automatically in background, the second app need to read this information periodically, how can I do to create interaction into two apps, can I use a file to do this ?
Upvotes: 1
Views: 2098
Reputation: 2124
Yes Communication can be made between two applications in iPhone but limited to a handful of scenarios.
1>There might be apps which need to be sending to background according to some event like phonecall,etc.In Such cases you will have to configure your audio-session object (a Voip based app) and send notification accordingly.
2>The previous example is just interacting between apps with extremely less flexibility(sending app to background on some important built in event).The other way to do this is through URL Schemes , apple has some built in functionality and support for certain applications such as mail.tel , etc.But one of the application will come to foreground.
Like you can call a phone number , which is built in application using :-
NSString *phURL= [NSString stringWithFormat:@"tel:%@", [NSString StringWithString:@"1-800-555-1212"]];
NSURL *phoneURL = [NSURL URLWithString:phURL];
[[UIApplication sharedApplication] openURL:phURL]];
By the way it's along story if You need to implement a Custom URL Schemes..have fun with it.
3>The other way is through UIDocumentInteractionController which provides in-app support to have interaction between certain files.(Sandbox environment inhibits a complete access or even accesses that can modify data of other application).Like it can be used to preview files in mail app or download attachments.But you cannot modify them for other application , of course you can copy it and modify it for your application.
Source: Link
Upvotes: 0
Reputation: 27618
apps are sandboxed ... meaning one app cannot talk to another app directly either read its data or share.
The only thing you can do is send info from one of your app to a server and read that info from that server in your second app.
Upvotes: 1
Reputation: 801
Your apps can interact via App Groups. First app create a file into shared container and other read it.
Upvotes: 0