Xcode WARNING: unused object: unused variable

I am working on this tutorial application and the code gives me this warning:

Xcode WARNING: unused object error: unused variable

It gives an error while executing this statement:

int newRowIndex = [self.checklist.items count];

What causes this? What steps should I take to solve this problem?

+3
source share
4 answers

The variable is newRowIndexinitialized, but not used anywhere.

+7
source

This warning means that you have created a variable newRowIndexbut are not using it anywhere.

To disable the warning, use intsomewhere like

int newRowIndex = [self.checklist.items count];
NSLog(@"New Row Index: %i", newRowIndex);
+3
source

, , , .

You can turn off warnings (not recommended, but if you just want to make sure that you can create something) by searching for "Warning Policies" and turning "Turn warnings as errors" to "None".

+2
source

If you really do not want to receive such warnings, follow these steps:

  • Go to the build settings of your project.
  • Find " Other warning flags "
  • Delete -Werror and -Wno-unused-parameter
+1
source

All Articles