After updating my code to swift 1.2 i stuck on one point
var Question:String!
var Answere:String!
var Answeres:[String]!
var ObjectIDsArray:[String]!
var ButtonNumber:String!
var ObjectIDsArrayCount:Int!
var query : PFQuery = PFQuery(className: "AddonQuiz")
query.getObjectInBackgroundWithId(QuestionID){
(ObjectHolder : PFObject?, error : NSError?) -> Void in
if error == nil {
self.Question = ObjectHolder["ImageLink"] as! String
self.Answeres = ObjectHolder["Answeres"] as! Array
self.Answere = ObjectHolder["Right"] as! String
if self.Answeres.count > 0 {
With the errors
Cannot assign a value of type 'AnyObject?' to a value of type 'String!'
Cannot assign a value of type 'AnyObject?' to a value of type '[String]!'
Cannot assign a value of type 'AnyObject?' to a value of type 'String!'
for Lines
self.Question = ObjectHolder["ImageLink"] as! String
self.Answeres = ObjectHolder["Answeres"] as! Array
self.Answere = ObjectHolder["Right"] as! String
Any work around for that?
if let ObjectHolder = ObjectHolder {
self.Question = ObjectHolder["ImageLink"] as! String
self.Answeres = ObjectHolder["Answeres"] as! Array
self.Answere = ObjectHolder["Right"] as! String
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With