ios - Parse: Create 1-to-1 relation on PFObject with support for multiple class types? -


i trying create pfobject subclass in parse has one-to-one relation pfobject in parse, relation support pfobject subclass. currently, create , save first pfobject parse, whatever pfobject connected set relation's 1 , accepted type, , creating second object connects different pfobject subclass relation generates error.

is there way either to...

  • specify desired class one-to-one relation (i.e., pointer) should connect to? , if so, support connecting subclasses of specified class?
  • create one-to-one relation supports kind of pfobject?

example:

for example, let's needed create subclass of pfobject called zookeeper in addition multiple subclasses of pfobject various types of animals: armadillo, bear, camel, etc. (and reasons must accept, each animal has have own pfobject subclass rather using generic animal class).

then let's each zookeeper responsible 1 animal. this, want create one-to-one relation on zookeeper called animal can specify single animal object each zookeeper responsible for.

i create multiple zookeeper , multiple animals. save first animal (an armadillo) , first zookeeper object ("alice") , second animal (a bear), when try save second zookeeper object ("bill") parse, following error:

invalid type key animal, expected *armadillo, got *bear

i not sure if want, you:

  1. create animal subclass in parse, text field called "type", , 1 column each of different types of animals (yeah, know isn't elegant).

  2. the column matching "type" column contains pointer specific animal object, while other columns nil.

  3. to specific animal object, need animal object, @ type column, , @ corresponding pointer column specific animal object.

for example, zookeeper object contains pointer animal object. "type" column of animal object contains text "bear". retrieve object in "bear" column of animal object, bear object. meet specification? yes there animal object, there still notion of specific animal objects bear, etc.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -