After updating to xCode 6.3 / Swift 1.2 I have run into an error I can't resolve: "Cast from '[SKNode]' to unrelated type 'String' always fails".
Below is my GameScene code which begins by parsing a p-list.
import SpriteKit
class GameScene: SKScene, SKPhysicsContactDelegate, NSXMLParserDelegate {
var currentTMXFile:String?
override func didMoveToView(view: SKView) {
/* Parse p-list */
let path = NSBundle.mainBundle().pathForResource("GameData", ofType: "plist")
let dict = NSDictionary(contentsOfFile: path!)!
let playerDict:AnyObject = dict.objectForKey("PlayerSettings")!
let gameDict:AnyObject = dict.objectForKey("GameSettings")!
let levelArray:AnyObject = dict.objectForKey("LevelSettings")!
if let levelNSArray:NSArray = levelArray as? NSArray {
var levelDict:AnyObject = levelNSArray[level]
numberOfLevels = levelNSArray.count
if let tmxFile = levelDict["TMXFile"] as? String {
currentTMXFile = tmxFile
}
}
The error is being thrown up at...
if let tmxFile = levelDict["TMXFile"] as? String {...
and is returning a nil value, even though there is a string value in the p-list and prior to updating, it was working fine. I have tried casting as AnyObject first and this throws up more errors.