首页 \ 问答 \ JSONRepresentation为NSMutableDictionary(JSONRepresentation for NSMutableDictionary)

JSONRepresentation为NSMutableDictionary(JSONRepresentation for NSMutableDictionary)

我想在NSMutableDictionary对象上调用JSONRepresentation方法。 我使用[userDict JSONRepresentation];来调用它[userDict JSONRepresentation]; ,但我收到以下警告:

NSMutableDictionary may not responsd to '-JSONRepresentation'

任何人都可以告诉我如何正确调用NSMutableDictionary类型的对象的JSONRepresentation方法?

提前致谢。


I want to call the JSONRepresentation method on an NSMutableDictionary object. I'm calling it using [userDict JSONRepresentation];, but I am getting the following warning:

NSMutableDictionary may not responsd to '-JSONRepresentation'

Could anyone tell me how to I can properly call the JSONRepresentation method on an object of the NSMutableDictionary type?

Thanks in advance.


原文:https://stackoverflow.com/questions/7143863
更新时间:2024-02-01 17:02

最满意答案

使用您的小代码,我猜你的复制构造函数和operator =有问题。 每次在向量中添加新项时,都会有一个复制调用。 对于指针向量的情况,没有问题,但是对于你的类,你的指针和地图会有问题。 正确实施这些方法,然后重试。


With your little code, I guess you have problems in your copy constructor and operator=. Each time you add new item in your vector, there is a copy invocation. In the case of vector of pointers, there is no problems, but with your class, you will have problems with your pointer and map. Implement these methods correctly and try again.

相关问答

更多
  • 看起来您希望行尾(用户点击“输入”)表示成绩结束。 这段代码会将整行引入自己的流对象 - 与cin不同 - 最终会达到目的 。 std::string grades_full_line; std::getline(std::cin, grades_full_line); std::stringstream grade_stream(grades_full_line); 您现在可以更改循环以将流本身用作条件。 当你到达终点时它会评估为false 。 for( grade_strea ...
  • 现在编译器没有给出任何警告。 编译器没有给出任何警告,因为你添加了足够的复杂性来欺骗你对代码的分析。 您仍然返回一个指向局部变量的指针,并且在函数返回后您不能使用该指针。 Now the compiler does not give any warning. The compiler isn't giving any warning because you've added sufficient complexity to fool the analysis that it does of your cod ...
  • 您可以通过以下方式执行此操作(例如): void * mem = malloc(1024); // 1 kb image.GetOutputData(mem, 1024); // Don't forget to free(mem); 其他方式: char * mem = new char[1024]; image.GetOutputData((void *)mem, 1024); // Don't forget to delete[] mem; 其他方式: char mem[1024]; im ...
  • 尽管您对这些函数的描述基本上是正确的,但值得指出的是GetProcessHeap , HeapAlloc和HeapFree函数实际上是Win32 API函数,这意味着它们是作为操作系统的一部分提供给应用程序调用的。 Irvine的库刚刚为这些函数提供了原型,使它们更容易调用。 因此,通过阅读Microsoft的MSDN文档(上面的链接),可以直接从马口获得这些功能的语义。 与文档解释的一样,对于需要分配大量内存以从进程的默认堆中获取内存的应用程序来说,它是一种常见模式。 这节省了管理单独的私有堆的创建和开销 ...
  • 您的问题的答案是高度操作系统特定的,甚至是特定时间的。 在物理内存有限的日子里,即使有分页,操作系统也常常将进程交换进出物理内存。 现在更依赖于分页。 P1可能有50页,但操作系统一次只能在内存中保留5页。 通常,页面仅在访问时加载。 加载页面必须有页面错误。 (该一般规则有例外)。 The answer to your question is highly operating system specific and even time specific. In ye olde days of limite ...
  • 使用时分配固定长度数组 data = new Item[size]; 您已在一个连续的内存块中一次性分配了数组的所有size元素。 您没有在数组中分配单个元素,也无法使用delete data[index]释放单个元素 - 完成后,您只能使用delete[] data释放整个数组。 如果您预计需要在数组末尾添加和删除元素,我建议使用std :: vector 。 如果您希望在数组中的任何位置添加和删除元素,则std :: list可能更有意义。 When you allocate a fixed-leng ...
  • 使用您的小代码,我猜你的复制构造函数和operator =有问题。 每次在向量中添加新项时,都会有一个复制调用。 对于指针向量的情况,没有问题,但是对于你的类,你的指针和地图会有问题。 正确实施这些方法,然后重试。 With your little code, I guess you have problems in your copy constructor and operator=. Each time you add new item in your vector, there is a copy ...
  • 不要使用矢量矢量矢量。 使用具有内部数组的类,然后提供访问元素的方法。 例如: template class vec3d { std::vector data; size_t xmax, ymax, zmax; public: T& operator()(size_t x, size_t y, size_t z) { return data[x+y*xmax+z*xmax*ymax]; } const ...
  • max_size()是向量可以存储的绝对最大元素数。 使用默认分配器,这通常是std::numeric_limits::max() / sizeof(T) 。 也就是说,它是您可能创建的最大类型的数组。 但是,您实际上永远无法分配那么大的数组。 程序加载的模块会占用程序的一些地址空间,每个线程的堆栈都会占用。 您可能在程序中有其他动态分配的对象(由您或运行时分配)。 这些都有助于解决空间碎片问题,这意味着可用地址空间的最大连续块远小于可用地址空间的总量。 简而言之,在实践中不可能使 ...

相关文章

更多

最新问答

更多
  • python的访问器方法有哪些
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。
  • 响应navi重叠h1和nav上的h1链接不起作用(Responsive navi overlaps h1 and navi links on h1 isn't working)
  • 在C中读取文件:“r”和“a +”标志的不同行为(Reading a File in C: different behavior for “r” and “a+” flags)
  • NFC提供什么样的带宽?(What Kind of Bandwidth does NFC Provide?)
  • 元素上的盒子阴影行为(box-shadow behaviour on elements)
  • Laravel检查是否存在记录(Laravel Checking If a Record Exists)
  • 设置base64图像的大小javascript - angularjs(set size of a base64 image javascript - angularjs)
  • 想学Linux 运维 深圳有哪个培训机构好一点
  • 为什么有时不需要在lambda中捕获一个常量变量?(Why is a const variable sometimes not required to be captured in a lambda?)
  • 在Framework 3.5中使用服务器标签<%=%>设置Visible属性(Set Visible property with server tag <%= %> in Framework 3.5)
  • AdoNetAppender中的log4net连接类型无效(log4net connection type invalid in AdoNetAppender)
  • 错误:发送后无法设置标题。(Error: Can't set headers after they are sent. authentication system)
  • 等待EC2实例重启(Wait for an EC2 instance to reboot)
  • 如何在红宝石中使用正则表达式?(How to do this in regex in ruby?)
  • 使用鼠标在OpenGL GLUT中绘制多边形(Draw a polygon in OpenGL GLUT with mouse)
  • 江民杀毒软件的KSysnon.sys模块是什么东西?
  • 处理器在传递到add_xpath()或add_value()时调用了什么顺序?(What order are processors called when passed into add_xpath() or add_value()?)
  • sp_updatestats是否导致SQL Server 2005中无法访问表?(Does sp_updatestats cause tables to be inaccessible in SQL Server 2005?)
  • 如何创建一个可以与持续运行的服务交互的CLI,类似于MySQL的shell?(How to create a CLI that can interact with a continuously running service, similar to MySQL's shell?)
  • AESGCM解密失败的MAC(AESGCM decryption failing with MAC)
  • SQL查询,其中字段不包含$ x(SQL Query Where Field DOES NOT Contain $x)
  • PerSession与PerCall(PerSession vs. PerCall)
  • C#:有两个构造函数的对象:如何限制哪些属性设置在一起?(C#: Object having two constructors: how to limit which properties are set together?)
  • 平衡一个精灵(Balancing a sprite)
  • n2cms Asp.net在“文件”菜单上给出错误(文件管理器)(n2cms Asp.net give error on Files menu (File Manager))
  • Zurb Foundation 4 - 嵌套网格对齐问题(Zurb Foundation 4 - Nested grid alignment issues)
  • 湖北京山哪里有修平板计算机的