IOS - UIPboard does not work outside the application

I think this is more of a SDK flaw than my applications, but lately I have been trying to use a UIP archive to copy strings from my application, and it works great when you ever enter the application.

When I switch to another application by pressing the home button or something like that, I just donโ€™t have the ability to paste the copied content.

UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; [pasteboard setString: @"blah" ]; NSLog(@"%@", pasteboard.string); 

In this case, it will print โ€œblah,โ€ and whenever I quickly touch the text field, it will display the insert option. But if I go to Safari, Notes or Mail, this will not show me this option.

In addition, if I copy something from the mail and go to my application, I will not see the paste option ...

+7
source share
5 answers

I have a similar problem. These may be some conflicts with some third-party libraries. I found that when I uninstall Flurry Analytics, everything is fine. I assume lib is doing something on the "EnterBackground" event.

You can try to โ€œcleanโ€ your application. remove function call on AppDelgate enterbackground delegate.

I mean, your code or the third part code can be executed during the "DidEnterBackground", which are massaging your clipboard. try not coding anything about this:

  • (void) applicationDidEnterBackground: (UIApplication * application) {}

Also try removing the third-party code that you need to call in: - (BOOL) application: (UIApplication *) application didFinishLaunchingWithOptions: (NSDictionary *) launchOptions -

+2
source

To make permanent cardboard between applications, you should use

 UIPasteboard *pasteboard = [UIPasteboard pasteboardWithName:pasteboardIdentifier create:YES]; [pasteboard setPersistent:YES]; [pasteboard setString:string]; 
+4
source

I was able to restore the functionality of the cardboard, returning to Flurry 2.8.4. Flurry 3.0.2 and 3.0.3 somehow disabled copy / paste support using external applications such as Notepad.

+1
source

Flurry seems to have solved this problem by releasing 3.0.4

Too bad, complaints from my users flooded my inbox ...

+1
source

// Save Text

  UIPasteboard* board = [UIPasteboard pasteboardWithName:@"com.company.wtv" create:YES]; board.persistent=YES; [board setValue:@"123456ccc" forPasteboardType:@"com.company.wtv.sharedValue"]; // Retrive text UIPasteboard* board = [UIPasteboard pasteboardWithName:@"com.company.wtv" create:YES]; board.persistent=YES; NSData* result=nil; NSString*resultStr=nil; result =[board valueForPasteboardType:@"com.company.wtv.sharedValue"]; resultStr=[[NSString alloc] initWithData:result encoding:NSUTF8StringEncoding];// I got resultStr containing 123456ccc NSLog(@"key %@",resultStr); 
+1
source

All Articles