问题
I have a strange issue, my subclassing works in all my view controllers except one.
I have imported everything that is required, but this one class is giving me the
"Missing argument for parameter 'className' in call"
My subclass
import Foundation
import Parse
class Session : PFObject, PFSubclassing {
class func parseClassName() -> String {
return "Session"
}
}
// i have removed the non important info
I perform the
Session.registerSubclass()
In the app delegate
In EVERY class I have i can create a session via
var se = Session()
But in this one class, this will not work.
The class
import UIKit
import Parse
class PurchaseViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
var se = Session()
// gives me an the above error
}
}
I've tried deleting the class, creating a new one even with a new name - still does not work.
MORE INFO
Ok... something made me try removing some local class Vars from the classes where the object creation works, I found that by removing
let currentUser = PFUser.currentUser()! as! FighterUser
// This is my subclassed PFUser object
Causes that class to throw there error, and adding this var into the ViewController that was not working before stops the error
Any logic to how / why this occurs? A bug ?
This works
import Parse
import UIKit
class PurchaseViewController: UIViewController {
let currentUser = PFUser.currentUser()! as! FighterUser
override func viewDidLoad() {
super.viewDidLoad()
var se = Session()
}
More Info 2
Even just adding
let currentUser = PFUser.currentUser()
Removes the error
回答1:
Yup, it's a bug that will be addressed in 1.7.3 https://developers.facebook.com/bugs/1647055045527392/
来源:https://stackoverflow.com/questions/30158193/ios-parse-pfobject-subclassing-with-swift-behaviour