mardi 5 juillet 2016

Xcode 8.0 unable to retrieve userData from SKTileDefinition


Xcode 8.0 beta (8S128d) iOS 10

I am trying to retrieve userData from SKTileDefinition but unable to get any return data.

I can retrieve the name with the following code -

    if let tileType = landBackground.tileDefinition(atColumn: column, row: row) {
        tileDef = tileType.name!
    } else {
        tileDef = "Nil"
    }

but when I try to retrieve the userData with the following code I get nil -

    if let tileType = landBackground.tileDefinition(atColumn: column, row: row) {
        if let data = tileType.userData?.value(forKey: "data") {
            tileDef = String(data)
        } else {
            tileDef = "no string data"
        }
    } else {
        tileDef = "Nil"
    }

I have confirmed userData is set for the tiles I am trying to return.

Has anyone managed to get get this feature working in Xcode 8.0 ?


Aucun commentaire:

Enregistrer un commentaire