mercredi 6 juillet 2016

Unable to enter if loop containing parsed JSON

I am weirdly unable to enter this if statement.

                    let idInJSON = dict2["customer_id"] as! Int
                    print("idInJSON is", idInJSON)

                    if idInJSON == purchaseInstance.customerID {
                        purchaseInstance.idsMatch = true
                        print("the value of idsMatch is", purchaseInstance.idsMatch)
                    } else {
                        print("unable to enter matching if else")
                    }

dict2 is a dictionary that lets me access the parsed json ."customer_id" is a value in the json file that is an integer. purchaseInstance.customerID is also an integer that is defined in a struct called Purchase. The customerID part of it is also an integer pulled from the JSON.

It doesn't crash, it just says "unable to enter matching if else"

Does anyone know why this is and could offer me some help? Thanks so much!

Aucun commentaire:

Enregistrer un commentaire