Sunil Targe
Sunil Targe

Reputation: 7459

How to use URL Scheme to share data between two apps without openURL method?

I have App A and App B. Here I just want to share text data from A to B and for that I doing following code.

In A :

UIApplication.sharedApplication().openURL(NSURL(string: "B://sample_text")!)

In B :

func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {
      print(url)
      return true
}

Output in B : B://sample_text

Using above code, I can able to send sample_text data from A to B. But App B is getting open that I don't want.

I want to share the same data and it should get in B when I launch B manually in future.

May be if there is any other method than openURL, then please suggest.

App Group can achieve this but it has limitation like you can only share data between applications that share a common app ID prefix.

Upvotes: 3

Views: 2172

Answers (1)

Daniel Zhang
Daniel Zhang

Reputation: 5858

You might want to check out App Groups to share data between your two apps instead of sharing data using a URL scheme.

An example can found at Sharing data in between apps in IOS.

The alternative is to store the data to, and read it from, a backend server.

Upvotes: 3

Related Questions