字符串值在目标C中始终显示为nil [英] string value always shows nil in objective C

查看:268
本文介绍了字符串值在目标C中始终显示为nil的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已升级到Xcode 5.0。当我在调试模式下运行应用程序并尝试在控制台中打印 NSString 值时,它会给出以下错误。有什么想法?

I have upgraded to Xcode 5.0. And when I run an app in debug mode and try to print an NSString value in console, it gives me the below error. Any ideas?

error: warning: couldn't get cmd pointer (substituting NULL): Couldn't load '_cmd' because its value couldn't be evaluated
Couldn't materialize struct: the variable 'stringValue' has no location, it may have been optimized out
Errored out in Execute, couldn't PrepareToExecuteJITExpression

以下是代码:

NSString *stringValue = [[self.responseArray objectAtIndex:i] valueForKey:@"merchant_name"]; 


推荐答案

原因在错误消息中说明:它可能已经过优化 ..这意味着您正在以优化的方式编译和运行代码。

The reason is stated in the error message: it may have been optimized out.. this means that you are compiling and running your code in an optimized manner.

您必须更改编译器优化级别从最快,最小

you gotta change your compiler optimization level from Fastest,Smallest to none:


  • 转到目标构建设置

  • 搜索优化级别

  • 将其更改为none(无论您采用何种模式,即调试,分发或发布)

  • 利润

  • go to your target build settings
  • search for optimization level
  • change it to none (whatever mode you are in ie debugging, distribution or release)
  • profit

为您的项目设置做同样的事情

do the same for your project settings

这篇关于字符串值在目标C中始终显示为nil的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆