Jean
Jean

Reputation: 2625

Can an app access sqlite table of another? - iPhone iOS

I think it's a dumb question ; anyways, to clear any possible assumption, I will ask it : I have 2 iOS apps : one free version and another paid version. Say, the user is using the free version, which has some SQLite tables in the device. Now, the user installs the paid version of the App (not an in-App purchase, but a separate paid version) ; now, can this newly installed paid version access the sqlite data of the free app, which is already in the device?

Upvotes: 1

Views: 307

Answers (2)

rmaddy
rmaddy

Reputation: 318794

Apps can not directly access the data of other apps. However, in a case like yours, you can write both apps to access a common UIPasteboard. Combined with each app having a custom URL scheme, there is a way to allow you write your free/paid apps so you can transfer the data between the two apps.

Here is an outline of the process:

  1. App A (full verion) looks for custom URL scheme of App B (lite version).
  2. If found show "transfer" button somewhere appropriate.
  3. User taps button in App A
  4. App A launches App B with URL that says "send me your data".
  5. App A exits and App B is launched.
  6. App B handles URL request.
  7. App B packages up its data and puts in a named UIPasteboard (name hardcoded in to App A and App B).
  8. App B launches App A with URL that says "you have data".
  9. App B exist and App A is relaunched.
  10. App A handles URL request.
  11. App A gets data from pasteboard, removes it from pasteboard, installs data into self, and refreshes.
  12. App A informs user transfer is complete.

The paid app should have a custom scheme of something like "myapppaid" and the free version should have a custom scheme of "myappfree".

Upvotes: 2

Nicholas Smith
Nicholas Smith

Reputation: 11754

With it just associated with the app, then no not directly as it only exists within the application sandbox which is available only to the application. If it's available via iCloud then you should be able to, as that's how a few apps have managed 'upgrades' when they've realised new standalone versions.

Upvotes: 0

Related Questions