-1

我的应用程序用于UITextView从用户那里获取一些输入,我使用 Xcode4.5 模拟器来进行 Ipad 5.1 ,ARC

如果用户尝试复制和粘贴带有公告或图像的文本,我会收到以下错误:

 Mapping '/Users/user/Library/Application Support/iPhone Simulator/5.1/Library/Caches/com.apple.keyboards/images/1848901318' failed: 'Cannot allocate memory' (12)

GuardMalloc[W]: Failed to VM allocate 16384 bytes
GuardMalloc[W]: Explicitly trapping into debugger!!!

我厌倦了用户以防止使用任何奇怪的字符或图像粘贴但无法使其工作,它甚至不会触发。

- (void)paste:(id)sender {
    UIPasteboard *pasteBoard = [UIPasteboard generalPasteboard];
    NSString *string = pasteBoard.string;
    NSLog(@"Pasteboard string: %@", string);
    [self.wodDescription insertText:string]; //woddesription is the textview
}

为什么我得到上述错误?解决此崩溃的最佳方法是什么?

4

1 回答 1

-1

我想我可以通过查看如何不粘贴来解决您的问题,而不是如何不使用此现有线程进行复制:

- (void)paste:(id)sender
{
    UIPasteboard *pasteBoard = [UIPasteboard generalPasteboard];
    NSString *string = pasteBoard.string;
    [self insertText:string];
}
于 2013-02-02T00:38:46.093 回答