objective c - Parse iOS Subclassing. Check if array field contains value -


i have 2 classes named event , tag (using localdatabase).

@interface event : pfobject <pfsubclassing> @property (nonatomic, strong) nsarray *tags;  @interface tag : pfobject <pfsubclassing> @property (nonatomic, strong) nsstring *name; 

tags field array of pointers objects of tag class. want add new tag event object , need check if there no such tag in array already. , if there no such tag - add it.

what best approach it?

additional question: how can query objects "tags" array (if, example, have several different array fields , lots of other fields , don't want use "includekey")?

edit: far understand, array field in parse contains pointers objects. if have, example, object event such fields tags, people, places (which arrays) actual data need fetch event object using includekey method. or can fetch whole event object it's related data. don't want do. want have array of, say, tags simple nsarray. like

nsarray *tags = [event tags]; 

thanks!

for first question, can not use containsobject nsarray class because underlying calls isequal each elements. in parse, there has convenient api add unique object , need call - (void)adduniqueobject:(id)object forkey:(nsstring *)key.

for additional question, think don't have without querying using includekey. after that, think <subclassing> category can enable line of code wrote.


Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -