Objective C can not process 2d array .count? -


i've got latest xcode xcode 4.6, , have problem:

nsarray *array = @[@[@"a",@"b"]]; nslog(@"%d", array[0].count); 

before run it, xcode told me "property 'count' not found on object of type 'id'".


but if change to

nslog(@"%d", [array[0] count]); 

then, fine.


so question is, why can't obj-c process two_d_array[index].count ?

looks @ docs nsarray. there no count property. in fact, there no properties @ nsarray.

when use property syntax non-property method, compiler deal ok if have object of specific type , there method of same name. in case have id. compiler can't safely work out attempt access count property should converted call count method.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -