我有一个包含“GameObject”对象的NSMutableArray。GameObject有许多属性,其中之一是“gameObjectType”。"gameObjectType"是GameObjectTypeEnum类型。我想过滤这个NSMutableArray,只返回某种类型的游戏对象。我已经做了以下工作,但它给了我一个“BAD ACCESS”错误:
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"gameObjectType = %@", gameObjectType];
return [gameObjects filteredArrayUsingPredicate:predicate];
在predicateWithFormat调用中是否可以传递“自定义”类型(即我定义的这个枚举)?