【问题标题】:Why can't I create a string in lldb?为什么我不能在 lldb 中创建字符串?
【发布时间】:2012-06-18 20:39:41
【问题描述】:

具体来说,为什么这不起作用?

(lldb) po [NSString stringWithCharacters:(char*)[data bytes] length:(int)[data length]]
error: Couldn't execute function; result was eExecutionDiscarded

还有其他关于转储 NSData 的问题,但我认为这将是一个更好的解决方案。我很惊讶它没有用。只是想了解原因。

【问题讨论】:

  • 我管理过类似的东西:[[[NSString alloc] initWithData:(char*)[@"James" dataUsingEncoding:4] encoding:4] autorelease] 4 是 NSUTF8StringEncoding,枚举在 lldb 中不可用。
  • 好的,詹姆斯,谢谢。这行得通。

标签: ios nsstring nsdata lldb


【解决方案1】:

可能是因为它需要 unichar?试试这个。

How to convert a unichar value to an NSString in Objective-C?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-10-05
    • 2011-12-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-03
    相关资源
    最近更新 更多