调试器仅显示字典的值和“(无摘要)"对于钥匙 [英] Debugger is only showing the values of a dictionary and "(no summary)" for the keys

查看:27
本文介绍了调试器仅显示字典的值和“(无摘要)"对于钥匙的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 AFNetworking 从我们的服务器获取 JSON 提要,然后我将 AFNetworking 给我的响应对象转换为 NSArray,我以前做过一百万次没有问题.JSON 只是一个数组,每个元素都是一个字典,没有什么太复杂的.

I'm using AFNetworking to grab a JSON feed from our server and then I'm casting the response object that AFNetworking gives me into an NSArray, something I've done a million times before with no problem. The JSON is just an array with each element being a dictionary, nothing too complex.

在将响应对象转换为 NSArray 后设置断点时,我遇到的问题就出现了.当调试器拉起时,它显示了 NSArray,表明 NSArray 中的每个对象都是一个 NSDictionary,但是当我查看 NSDictionary 的内容时,它只会显示值而不是键.键仅显示为(无摘要)"

The issue I'm having comes in when I set a breakpoint after I cast the response object to my NSArray. When the debugger pulls up, it shows the NSArray, shows that each object in the NSArray is an NSDictionary, but when I go to view the contents of the NSDictionary's, it will only displays the values and not the keys. The keys only appear as "(no summary)"

我已在浏览器中打开提要进行仔细检查,并使用在线 JSON 验证器来确保提要有效且一切正常.

I've opened up the feed in my browser to double check it, and I used an online JSON validator to make sure the feed is valid and everything looks normal.

就其价值而言,这仅在我将 XCode 更新到最新版本 (7.3) 后才开始.

For what it's worth, this only started after I updated XCode to the most current version (7.3).

这个问题至少也影响到了我的一位同事,他也不知道如何解决.非常感谢让 XCode 显示键的修复程序.

This problem is also affecting at least one coworker of mine, and he couldn't figure out how to fix it either. A fix to make XCode display the keys would be much appreciated.

更新

将近三年后又换了一份新工作,我想我明白了为什么会发生这种情况 - 尽管我无法确认,因为我无法再访问我正在从事的原始项目.

Almost three years and a new job later, I think I figured out why this was happening - though I can't confirm it since I no longer have access to the original project I was working on.

几周前我再次遇到这个问题 - 我的调试器告诉我有些项目为零,在某些字典键上给出了无摘要"等.这让我发疯了.

A few weeks ago I ran into this issue again - my debugger was telling me that some items were nil, gave 'no summary' on some dictionary keys, etc. It was driving me crazy.

控制台给了我一些关于正在发生的事情的提示,说它是通过优化编译的,这可能会导致调试器问题(或类似的问题),但这只是导致我删除了调试器中的优化标志.这只会使我的构建变慢,并没有使我的调试器正确运行.

The console gave me some hints as to what was going on by saying it was compiled with optimizations which may lead to debugger issues (or something along those lines) but that just led me to removing the optimization flags in the debugger. This just made my builds slow and did nothing to make my debugger act right.

事实证明,在某些时候我已经将我的方案的构建配置从调试"更改为发布".在发布"配置中,符号调试信息没有发出,代码执行得到优化——因此为什么控制台对我大喊我的代码是用优化编译的,以及为什么我的调试器正在运行.

As it turns out, at some point I had changed my scheme's build configuration from 'Debug' to 'Release'. In the 'Release' configuration symbolic debug information is not emitted and code execution is optimized - hence why the console was yelling at me that my code was compiled with optimizations and why my debugger was acting up.

将 Scheme 的构建配置切换回调试"解决了我的问题.

Switching the Scheme's build configuration back to 'Debug' solved my issue.

虽然我不知道这是否真的解决了我原来的问题,但它解决了一个类似的问题.希望这会帮助其他偶然发现这个问题的人.

While I don't know if this actually solves my original problem, it solved a similar one. Hopefully this will help others that stumble upon this question.

推荐答案

我有同样的问题.当我尝试使用 iPhone 5s Simulator 进行调试时,我看到的结果与您相同:

I have the same problem. When I try debug with iPhone 5s Simulator, I see the same results as you:

但在 iPhone 5 模拟器中它没问题:)

But in iPhone 5 Simulator it is O.K :)

尝试使用其他模拟器(5 或 4 秒)

Try use another Simulator (5 or 4s)

这篇关于调试器仅显示字典的值和“(无摘要)"对于钥匙的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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