I'm new to Objective-C and iPhone development, and I'm trying to store floating-point values in an NSMutableArray, but when I do I get an error saying "incompatible type for argument 1 of 'addObject". What am I doing wrong? I'm trying to create an array of doubles that I can perform math calculations with.
Objective-c – How to create an NSMutableArray of floating point values
arraysdoubleiphoneobjective c
Related Topic
- Javascript – How to append something to an array
- Javascript – How to insert an item into an array at a specific index (JavaScript)
- Ios – How to sort an NSMutableArray with custom objects in it
- Java – How to determine whether an array contains a particular value in Java
- Javascript – How to empty an array in JavaScript
- Javascript – How to create an array containing 1…N
- Javascript – How to check if an object is an array?
- Javascript – How to remove a specific item from an array
Best Answer
NSMutableArray only holds objects, so you want an array to be loaded with NSNumber objects. Create each NSNumber to hold your double then add it to your array. Perhaps something like this.
Repeat as needed.