I have an NSArray
containing multiple NSArray
s. But I need get the count
or size of a particular array but I can not figureout how to do it.
I try in the console:
p [_mainArray[0]count] // error: no known method '-count'; cast the message send to the method's return type
I'll really appreciate if any of knows how can I get the count of the array inside of the array.
如错误所示,您需要转换从数组中检索到的对象:
p [(NSArray *)_mainArray[0] count]
The problem is that _mainArray[0]
returns a type of id
. To help the debugger, do what it says:
p [(NSArray *)_mainArray[0] count];
The cast tells the debugger that the results of _mainArray[0]
is an NSArray
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.