Reputation: 1795
Hey gusys, why im getting this error?
The code is this. Im receiving a string on my function (a string like this "1799.00");
-(void) priceFormat:(NSString*)preco {
float x = preco; /* Incompatible types in initialization */
if(x > 0) {
}
}
Upvotes: 0
Views: 111
Reputation: 6405
float x = [preco floatValue];
You have to convert the string to a floating-point value.
Upvotes: 2