如何在我的子类中初始化Parse指针

时间:2015-10-21 21:47:01

标签: ios parse-platform

我知道如何设置字符串等,但是如何设置指向另一个类的指针?谢谢!

import UIKit
import Parse

class Tag: PFObject {

   override class func initialize() {
      struct Static {
         static var onceToken : dispatch_once_t = 0;
      }
      dispatch_once(&Static.onceToken) {

         self.registerSubclass()
      }
   }

   @NSManaged var ID: String?
   @NSManaged var stanceName: String?
   @NSManaged var stanceValue: NSNumber?

   // HOW DO I DO SOMETHING LIKE THIS?
   @NSManaged var user: PointerToUserClass?
}

1 个答案:

答案 0 :(得分:0)

用户类很特殊,这样做:

@NSManaged var user: PFUser?

对于其他Parse对象,请使用:

@NSManaged var object: PFObject?

或者,如果您已经将Parse对象子类化,那么您可以使用您的子类:

@NSManaged var myTag: Tag?