UIPasteboard truncating strings when pasting multiple items into Mail

∥☆過路亽.° 提交于 2019-12-11 10:04:02

问题


My app attempts to copy images and text in sequence to the pasteboard, as a series of items.

I am finding that text strings are truncated at the first "\n" character when they are pasted from the pasteboard into Mail.

I would think it was to do with the encoding, but the weird thing is that it handles these "\n" characters just fine in the first string copied to the pasteboard, it is only a problem with subsequent ones.

NSMutableArray *clipArray=[[NSMutableArray alloc] init];
  for (int i=0;i<[addressList count];i++) {
    NSDictionary *current=[addressList objectAtIndex:i];
    NSString *text= [NSString stringWithFormat:@"%@\n",[current objectForKey:DATA_KEY] ];           
    NSDictionary *item=[NSDictionary dictionaryWithObjectsAndKeys:text,(NSString *)kUTTypeUTF8PlainText,nil];           
    [clipArray addObject:item];
  }
pasteboard.items=clipArray;
NSLog (@"%@",clipArray);

The NSLog prints all strings at full length, so I know they are being stored in the pasteboard. They also paste at full length into Pages.

Any idea why the Mail app should treat this differently?


回答1:


you are printing out the nslog of the array. try printing out the pasteboard.items and you'll see what the problem is.



来源:https://stackoverflow.com/questions/7444590/uipasteboard-truncating-strings-when-pasting-multiple-items-into-mail

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!