无法获取NSDictionary键的值,得到错误:进程已返回到表达式求值之前的状态

时间:2015-04-05 22:05:24

标签: ios swift

任何人都可以帮助我摆脱这个错误吗?我可以获取NSDictionary hiinIdPair,但是当我尝试获取tmpId的{​​{1}}键的值时,它会向我抛出此错误:

hiinIdPair

下面是lldb信息。

error: Execution was interrupted, reason: signal SIGABRT.

代码我使用这些变量:

(lldb) po hiinIdPair["tmpId"]
iV_Starter(371,0x198ebb310) malloc: *** error for object 0x10a7ddbb0: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
error: Execution was interrupted, reason: signal SIGABRT.
The process has been returned to the state before expression evaluation.
(lldb) po hiinIdPair
{
    mongoId = 5521ae815730c6051476f8b1;
    tmpId = "#h20150405a215200a506705";
}

2 个答案:

答案 0 :(得分:2)

请注意,因为"tmpId"不是objc中的NSString。您应该添加@字符。

错误:

po hiinIdPair["tmpId"]

正确:

po hiinIdPair[@"tmpId"]

答案 1 :(得分:0)

似乎它是代码其他部分的错误。代码由bug终止。

无论如何,感谢您的帮助!