objective c - Filtering NSMutableArray based on enum property -


I found an NSMutableArray filling with objects of type "game object". GameObject has many properties, one of which is "gameObjectType". "GameObjectType" type is of GameObjectTypeEnum. I want to be able to filter this NSMutableArray so that only a certain type of GameObjects is returned, I have found the following location, but it is giving me a "poor access" error:

  NSPredicate * predicate = [NSPredicate predicateWithFormat: @ "gameObjectType =% @", gameObjectType]; Return [gameObjects filteredArrayUsingPredicate: predicate];  

Is it possible to define this "custom" type (i.e., this enum I have defined)? Format call with format?

string format specifier % @ indicates an object, whereas you Integral values ​​are passing. You probably want to type gameObjectType a int and use the % d specification. For more information, take a look at this


Comments

Post a Comment

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -