Adding integer values as contents of an array,iphone -


I need to store some integer values ​​as the contents of an array. But when I try to do this So, it throws a warning, passes argument 1 of 'ad object', creates an indicator with an integer without an artist. And obviously the value is not stored in the array. Here's the code.

  NSUIENTER i; (I = 0; i <5; i ++) {[array addObject: i];}  

NSArray -s non- id can not store items, you must box it in NSNumber :

  NSUInteger i; For (i = 0; i <5; i ++) {[array addObject: [NSNumber number: with UN: i]]; }  

or use CFArray with custom callback (but you abandon readability for performance) or std :: vector & lt ; NSUInteger & gt; (But you need to use Objective-C ++).


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -