I am new to obj C, and coming from a very good C++ background. I started iOS dev, and made a custom object which I use in a View.
This Custom object is
@interface GameData : NSObject{
@private
int Lives;
...
bool isAnswered[5];
};
-(int)getLives;
-(void)LivesPlusOne;
...
-(void)increasePoints:(int)howManyPoints ;
-(int)getMult;
...
-(void)markAsAnswered:(int)idToRemove; //idToRemove is marked as answered
-(bool)isMarkedAsAnswered:(int)idToCheck;
@end
My Problem is that, although XCode recognizes and autocompletes methods like gameData.getLives; and compiles them just OK ( i use #import “GameData.h” ), it does not for methods with a parameter,like:
-(bool)isMarkedAsAnswered:(int)idToCheck;
which might be the problem? (I already tried deleting derived data (window->organizer->projects->derived data->delete) and nothing changed.
Extra info: I am using the gameData object in a View and i manipulate the “int Lives”ect, via accessors and mutators (getters/setters) and works really fine. When I get to use
[gameData.isMarkedAsAnswered:someInt]
I get a build error.
it does not even autocomplete when I type
[gamedata.i
Thanks in Advance,
Giorgos
You’re mixing up C++ and Objective-C syntax. You use the dot accessor to refer to declared properties, not methods. Use the following:
Due to implementation issues, when a method has no arguments, you can call it using the dot accessor, however this is not what it was designed for and you should stop doing so immediately.