String format is not an alphabetic string (potentially unsafe)

Possible duplicate:
Warning: "format is not a string literal and format arguments"

I have the following line of code that is in my application that the Developer was working on. I am learning the basics of Objective-C, and when I updated the application for compatibility with iPhone 5, I see the following warning (I did not change its code). The String format is not a literal string (potentially unsafe). The code is as follows:

self.progressHud.labelText = [NSString stringWithFormat:message]; 

I don’t know exactly what this means and I don’t want to download anything that could be a security issue or Apple rejects. Any help is appreciated by all of you.

+4
source share
1 answer

Use the following lines:

 self.progressHud.labelText = [NSString stringWithFormat:@"%@", message]; 

In a C object, this string gets values ​​from any format, such as int, float, etc., to display the label. because UILabel and IBOutlet Elements only display NSString values.

However, if you do not need to create a string with multiple variables, it would be more efficient to simply use:

 self.progressHud.labelText = message; 
+10
source

Source: https://habr.com/ru/post/1440927/


All Articles