I've written this piece of code:
for (int i = 1; i < 1000; i++) {
for (int j = 1; j < 1000; j++) {
int k = i * j;
//This is the line were the error messages appears
NSString *number = [NSString stringWithFormat:@"%d", k];
NSNumber *length = number.length;
NSNumber *half = (length / 2);
What I want it to do, is to take the int k
, convert it into a NSString named number
, store the length of the string number
in the NSNumber length
, and half of that value in the NSNumber half
.
However, when trying to convert the int k
to the NSString number
I get the error message:
"Implicit conversion of 'NSInteger' (aka 'unsigned int') to 'NSNumber *' is disallowed with arc"
Could someone help me figure out why?