ios - Subclass of subclass of PFObject not being registered -


i have class called attendee inherits pfobject. have class called speaker child of attendee.

below class definition attendee & speaker

class attendee: pfobject, pfsubclassing {     override class func initialize() {         var oncetoken : dispatch_once_t = 0;         dispatch_once(&oncetoken) {             self.registersubclass()         }     }      class func parseclassname() -> string {         return "attendee"     } }  class speaker: attendee {     override class func initialize() {         var oncetoken : dispatch_once_t = 0;         dispatch_once(&oncetoken) {             self.registersubclass()         }     } } 

i register both in applicationdidfinishlaunch method before using parse features:

func application(application: uiapplication, didfinishlaunchingwithoptions launchoptions: [nsobject: anyobject]?) -> bool {     speaker.initialize()     attendee.initialize()      parse.setapplicationid(objectmanager.appid, clientkey: objectmanager.clientkey)      ... } 

however, when try use attendee , speaker classes later on in code, error:

the class medconf.attendee must registered registersubclass before using parse.

the code triggers error is: var attendee = attendee()

i don't understand why happening, register both subclasses before them.

my bet can't subclass class implements pfsubclassing protocol. try making speaker it's own class , build relationship use relationship api in parse. if need resource build relational data, check here. https://www.parse.com/docs/ios/guide#objects-relational-data


Comments