0

est ici l'observateur de notification pour l'événement de changement Pasteboard, j'ai besoin pour gérer la copie du texte sélectionnéiOS 6: UserInfo retourne zéro pour le changement Pasteboard Avis

[[NSNotificationCenter defaultCenter] addObserver:self 
             selector:@selector(receiveClipBoardNotification:) 
              name:@"UIPasteboardChangedNotification" 
              object:nil]; 

Et voici la mise en œuvre de la méthode de sélection de receiveClipBoardNotification:

- (void) receiveClipBoardNotification:(NSNotification *) notification { 

// NSMutableArray *typesAddedKey = [[notification userInfo] objectForKey:@"UIPasteboardChangedTypesAddedKey"]; 
// pasteBoardItemType = [typesAddedKey objectAtIndex:0];   

    NSLog(@"%@", [notification userInfo]); 
} 

Le problème est que [notification userInfo] renvoie nil sur iOS 6, bien qu'il fonctionne parfaitement sur iOS 5.

Répondre

0

Eh bien, Cela a fonctionné sur iOS 6

NSLog(@"%@", [[UIPasteboard generalPasteboard] string]); 
Questions connexes