Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Implicit conversion of a non-Objective-C pointer type 'char *' to 'NSString *' is disallowed with ARC

For the following line of code I am getting the error below:

for (UILabel *label in labels) {
    label.text = label.tag - 100 > someMutableString.length ? "" : "*";
}

The error states:

Implicit conversion of a non-Objective-C pointer type 'char *' to 'NSString *' is disallowed with ARC

My variable "someMutableString" is of type NSMutableString.

How do I fix in my particular case?

like image 579
motionpotion Avatar asked Dec 20 '22 10:12

motionpotion


1 Answers

The problem is that your string literals are "" and "*" which are both C-style strings (const char*). So the type of the right hand side of the assignment is also const char*. You are assigning to the text property of a UILabel, which takes an NSString.

Use @"" and @"*" instead.

like image 139
Ken Thomases Avatar answered Jan 11 '23 23:01

Ken Thomases