• <bdo id='y9ZWI'></bdo><ul id='y9ZWI'></ul>

    <small id='y9ZWI'></small><noframes id='y9ZWI'>

    1. <legend id='y9ZWI'><style id='y9ZWI'><dir id='y9ZWI'><q id='y9ZWI'></q></dir></style></legend><tfoot id='y9ZWI'></tfoot>
        <i id='y9ZWI'><tr id='y9ZWI'><dt id='y9ZWI'><q id='y9ZWI'><span id='y9ZWI'><b id='y9ZWI'><form id='y9ZWI'><ins id='y9ZWI'></ins><ul id='y9ZWI'></ul><sub id='y9ZWI'></sub></form><legend id='y9ZWI'></legend><bdo id='y9ZWI'><pre id='y9ZWI'><center id='y9ZWI'></center></pre></bdo></b><th id='y9ZWI'></th></span></q></dt></tr></i><div id='y9ZWI'><tfoot id='y9ZWI'></tfoot><dl id='y9ZWI'><fieldset id='y9ZWI'></fieldset></dl></div>
      1. 如何让 NSJSONSerialization 将布尔值输出为真或假?

        How do I get NSJSONSerialization to output a boolean as true or false?(如何让 NSJSONSerialization 将布尔值输出为真或假?)

          <tbody id='x03Fp'></tbody>

            <tfoot id='x03Fp'></tfoot>
              • <bdo id='x03Fp'></bdo><ul id='x03Fp'></ul>

                  <legend id='x03Fp'><style id='x03Fp'><dir id='x03Fp'><q id='x03Fp'></q></dir></style></legend>

                1. <small id='x03Fp'></small><noframes id='x03Fp'>

                  <i id='x03Fp'><tr id='x03Fp'><dt id='x03Fp'><q id='x03Fp'><span id='x03Fp'><b id='x03Fp'><form id='x03Fp'><ins id='x03Fp'></ins><ul id='x03Fp'></ul><sub id='x03Fp'></sub></form><legend id='x03Fp'></legend><bdo id='x03Fp'><pre id='x03Fp'><center id='x03Fp'></center></pre></bdo></b><th id='x03Fp'></th></span></q></dt></tr></i><div id='x03Fp'><tfoot id='x03Fp'></tfoot><dl id='x03Fp'><fieldset id='x03Fp'></fieldset></dl></div>
                  本文介绍了如何让 NSJSONSerialization 将布尔值输出为真或假?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在使用 NSJSONSerialization dataWithJSONObject 将我的类序列化为 JSON.当它序列化一个 BOOL 时,它会在 JSON 字符串中为其提供值 1 或 0.我需要这是真或假.这可以通用吗?

                  I'm using NSJSONSerialization dataWithJSONObject to serialize my classes to JSON. When it serializes a BOOL, it gives it the value 1 or 0 in the JSON string. I need this to be true or false instead. Is this possible to do generically?

                  推荐答案

                  不,Bool 的基础对象是 NSNumber numberWithBool,它变成 0 或 1.我们没有 Bool 对象.阅读 JSON 也是如此.True/false 将再次变为 NSNumber.

                  No, the Foundation Object for a Bool is NSNumber numberWithBool, which becomes either 0 or 1. We have no Bool Object. Same go for reading JSON. True/false will become a NSNumber again.

                  您可以创建一个 Bool 类并构建自己的解析器.数组是数组,JSON 对象是 NSDictionary.您可以查询密钥,测试其背后的类并从中构建 JSON 字符串.

                  You could create an Bool Class and build your own parser. Arrays are Arrays and JSON Objects are NSDictionary. You can query the keys, test what Class lies behind and build the JSON String from this.

                  这篇关于如何让 NSJSONSerialization 将布尔值输出为真或假?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Hardware Volume buttons change in app volume(硬件音量按钮更改应用程序音量)
                  Resume game cocos2d(恢复游戏 cocos2d)
                  Cocos2D + Disabling only Retina iPad Graphics(Cocos2D + 仅禁用 Retina iPad 图形)
                  [ios.cocos2d+box2d]how to disable auto-rotation?([ios.cocos2d+box2d]如何禁用自动旋转?)
                  Storing and reading files from Documents directory iOS 5(从 Documents 目录存储和读取文件 iOS 5)
                  How can I implement a virtual joystick for a cocos2d game outside the cocos2d environment?(如何在 cocos2d 环境之外实现 cocos2d 游戏的虚拟摇杆?)

                  <small id='LDwz0'></small><noframes id='LDwz0'>

                    <tfoot id='LDwz0'></tfoot>
                      <tbody id='LDwz0'></tbody>

                      1. <legend id='LDwz0'><style id='LDwz0'><dir id='LDwz0'><q id='LDwz0'></q></dir></style></legend>
                      2. <i id='LDwz0'><tr id='LDwz0'><dt id='LDwz0'><q id='LDwz0'><span id='LDwz0'><b id='LDwz0'><form id='LDwz0'><ins id='LDwz0'></ins><ul id='LDwz0'></ul><sub id='LDwz0'></sub></form><legend id='LDwz0'></legend><bdo id='LDwz0'><pre id='LDwz0'><center id='LDwz0'></center></pre></bdo></b><th id='LDwz0'></th></span></q></dt></tr></i><div id='LDwz0'><tfoot id='LDwz0'></tfoot><dl id='LDwz0'><fieldset id='LDwz0'></fieldset></dl></div>

                            <bdo id='LDwz0'></bdo><ul id='LDwz0'></ul>