.comment-link {margin-left:.6em;}

IntTech

Tuesday, May 19, 2009

Strange Xcode Error

I was helping someone that was getting a bizarre error message from XCode. The message was Error: Cannot use object as a parameter to a method. The line with the error:

- (NSString)formatPrice:(NSNumber *)priceNumber

This was some what misleading since you first look at the parameter for the method "priceNumber", but the error really referred to what was being returned from the method. The problem was the leading (NSString), which was a typo that should have been (NSString *). Easy to over look that with attention directed to the "parameter." Once that change was made, the code compiled and ran correctly.

Bookmark and Share

0 Comments:

Post a Comment

<< Home


Google