I’m struggling with concatenating NSStrings and ints. In isolation the below code works great. It returns “This is a test string with an int 10”
int myInt =10;
NSString *newstring =
[NSString stringWithFormat: @"This is a test string with an int %i", myInt];
NSLog(@"%@", newstring);
However when I put the below code into my project i get an error: Implicit conversion of int to NSString is disallowed with arc.”
[_mycrop setTempLeft: (@"left value %i is %i", count, [_mycrop leftValue])];
Could anybody suggest where I’m going wrong? Although im passing in 2 variables, to my mind both are essentially the same.
The code “in isolation” is very different from the second code.
You have to use
stringWithFormat:in the second example too.Or with two lines but easier to understand:
Some documentation: Apple String Programming Guide – Formatting String Objects