6

I use the UIPasteboard class to use data with severals app. The doc say that the persistancy is removed when the creator application is uninstalled. I do two app, one for copy, the other for past:

creator app:

-(IBAction)paste:(id)sender{
    UIPasteboard* pb = [UIPasteboard pasteboardWithName:@"mytext" create:YES];
    tv_pasting.text = pb.string;

}

reader app:

-(IBAction)copy:(id)sender{

    UIPasteboard* pb = [UIPasteboard pasteboardWithName:@"mytext" create:YES];
    pb.persistent = YES;
    pb.string = tf_copy.text;
}

I do a text copy in my first app, I paste on my second app, the text is copied, all is good. After, I uninstall my two app and reinstall the reader app. I do paste... and the older copy is still available. Why ?

Manlio
  • 10,768
  • 9
  • 50
  • 79
Anthony
  • 2,801
  • 3
  • 30
  • 49

1 Answers1

5

After some tests, I found that It removed the UIPasteBoard if the name of it has a link with the bundle identifier of the App.

So if my bundle identifier is

com.test.MyTestApp

the UIPasteBoard name should be

@"com.test.MyTestApp.MyPasteBoard"

Then it will be removed. This is what testing taught me.

delannoyk
  • 1,216
  • 1
  • 12
  • 22