In versions of Xcode previous to 5, we can disable ARC in the project settings when we create the project. Now ARC is causing this problem for me.
With an property
If you want manual reference counting (using retains and releases) you can disable ARC in the build settings.
Select the project in the project navigator. The editor area should show you a view with four tabs: info, build settings, build phases, build rules. Select build settings.
To the left of those four titles, there should be a drop down list for selecting the target you want. Select the target you don't want ARC for.
Scroll down to find the section titled "Apple LLVM 5.0 - Language - Objective-C". Under there are three settings. The bottom one should be "Objective-C Automatic Reference Counting". Set that to "No" and you will have manual reference counting.
It might be a better option, however, to fix the reported problem. It's better to use ARC than not.
To Fix the error
You say your error occurred on the line where you create the obis
array. This means that one or more of the following variables is an int
instead of an object:
compteur1, compteur2, compteur3, compteur4, compteur5, nameC1, nameC2, nameC3, nameC4, nameC5
If you want to put an integer into an array, you have to box it as an NSNumber
e.g.
NSArray* anArray = [NSArray arrayWithObjects: [NSNumber numberWithInt: 2], nil];
There is a shorthand form of writing that now, which looks like this:
NSArray* anArray = @[ @(2) ];
Here are the steps I recommend: