简体   繁体   English

什么是__NSArrayI和__NSArrayM? 如何转换为NSArray?

[英]What is __NSArrayI and __NSArrayM? How to convert to NSArray?

What is __NSArrayI and __NSArrayM? 什么是__NSArrayI和__NSArrayM?

__NSArrayI(or M) cause "unrecognized selector" error. __NSArrayI(或M)导致“无法识别的选择器”错误。

How to convert to NSArray? 如何转换为NSArray?


I did test to parse json, twitter api. 我做了测试来解析json,twitter api。

http://api.twitter.com/1/followers/ids.json?cursor=-1&screen_name=twitterapi http://api.twitter.com/1/followers/ids.json?cursor=-1&screen_name=twitterapi

==> works fine. ==>正常工作。 parsed object is NSCFDictionary class. 解析的对象是NSCFDictionary类。 (This dictionary contains __NSArrayM class) (此词典包含__NSArrayM类)

http://api.twitter.com/1/statuses/user_timeline.json?&screen_name=twitterapi http://api.twitter.com/1/statuses/user_timeline.json?&screen_name=twitterapi

==> error. ==>错误。 parsed object is __NSArrayM class. 解析的对象是__NSArrayM类。

__NSArrayI is a code-word for an immutable array - that is, a "regular" NSArray which you cannot change. __NSArrayI是不可__NSArrayI的代码字,也就是无法更改的“常规” NSArray

__NSArrayM is a code-word for a mutable array - that is, NSMutableArray . __NSArrayM是可变数组的代码字,即NSMutableArray In NSMutableArray , you can add and remove items. NSMutableArray ,您可以添加和删除项目。

These are classes of the private api. 这些是私有api的类。 There is a project where you can see all classes of the private api. 一个项目 ,您可以在其中查看私有api的所有类。 You are not allowed to use them inside an app for the app store but sometimes it is useful too see how to access the objects and also what kind of object it is. 不允许您在app store内的应用内使用它们,但有时也很有用,例如如何访问对象以及对象是哪种对象。 They cannot be converted. 它们无法转换。 I think, getting these kind of objects inside the debugger is just the representation of internal classes, for the classes you are using inside your project. 我认为,对于在项目内部使用的类,在调试器中获取此类对象只是内部类的表示。 Knowing what kind of class it is, lets you also understand where to look for the problem inside your code. 知道它是哪种类,就可以了解在代码内部查找问题的位置。

Here you can see a short lookup of both: 在这里,您可以看到两者的简短查找:

__NSArrayI __NSArrayI

在此处输入图片说明

__NSArrayM __NSArrayM

在此处输入图片说明

It is private classes. 这是私人课程。 You shouldn't want to access them or moreover convert them. 您不应该访问它们或将其转换。

If I'm not mistaken NSArray is subclass of _NSArray . 如果我没记错的话, NSArray_NSArray子类。

If you are adding/removing some objects to/from your array check that it is of mutable type : NSMutableArray 如果要向数组中添加/删除某些对象,请检查数组是否为可变类型: NSMutableArray

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM