开发者

UIPasteboard truncating strings when pasting multiple items into Mail

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?


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜