Tirth
Tirth

Reputation: 7789

Problem with NSMutableArray?

i initialize instance variables in .h file,

NSInteger saveValue0, saveValue1, saveValue2, saveValue3;

NSMutableArray *nodeArray;

Now in .m file, in viewWillAppear event,

saveValue0 = 0; 
saveValue1 = 2; 
saveValue2 = 3;
saveValue3 = 0;

nodeArray = [[NSMutableArray alloc] initWithObjects:saveValue0, saveValue1, saveValue2, saveValue3, nil]; 

But above variable does not inserted in the array. When i trying to see the objects in array using break point, it gives me 0 objects present in nodeArray. Why it will give me 0 objects. Any reason behind that?

Upvotes: 2

Views: 156

Answers (2)

Qamar Suleiman
Qamar Suleiman

Reputation: 41

NSInteger is just a standard C type.U cannot add those into NSMutableArray

Upvotes: 0

user23743
user23743

Reputation:

NSInteger is not an object, and you can only store objects in arrays. Use [NSNumber numberWithInteger:0] etc.

Upvotes: 2

Related Questions