Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIPasteboard (generalPasteboard) items lifetime

How much time do items live in general pasteboard?

Apple's documentation says:

The general pasteboard is persistent across device restarts and app uninstalls.

What I have:

  • Two (or more) apps signed with profiles with different team IDs;
  • Apps have to store theirs custom url schemes in a common place;

What I'm going to do:

  • Use [UIPasteboard generalPasteboard] to store these schemes in order to be accessible from all those apps.

What I need:

  • Those apps need to have access to this common "storage";
  • To be sure that pasteboard items will persist during a long period of time (always :-));

General pasteboard is persistent. That's clear, but is not clear about items lifetime in this pasteboard.

Basically the questions is: can I use general pasteboard as an inter app storage (for long periods of time) ?

Updates:

P.S. I understand that this is not a good (correct) approach but I need that all those apps to know each others schemes, so one shared storage and accessible at any time is required (I can't expect when the user will open all those apps). I need a solution without involving a backend.

like image 664
Alex Maimescu Avatar asked Oct 21 '22 19:10

Alex Maimescu


1 Answers

can I use general pasteboard as a inter app storage (for long periods of time)

No. The general pasteboard is meant to allow applications to share data in response to an explicit user action. It's not meant to be a common database or repository. In fact, no other application is required to (nor should they) save the existing contents when writing to the general pasteboard. Your URL schemes would be overwritten with the very next copy the user initiated.

like image 86
MyztikJenz Avatar answered Oct 23 '22 09:10

MyztikJenz