Ever since the latest update to XCode the following two lines of codes have compile errors. Can anybody please advice me on the adjustments I need to make to get the program to compile and run again?
var sceneData = NSData.dataWithContentsOfFile(path, options: .DataReadingMappedIfSafe, error: nil)
var archiver = NSKeyedUnarchiver(forReadingWithData: sceneData) archiver.setClass(self.classForKeyedUnarchiver(), forClassName: "SKScene")
Any help would be appreciated, thank you.
You can use (iOS < 8.0)
NSData.dataWithContentsOfMappedFile(path)
or (iOS >= 7.0)
var sceneData = NSData(contentsOfFile: path, options: .DataReadingMappedIfSafe, error: nil)
If you create a new SpriteKit sample project in XCode 6.1, you will see the changes.
尝试这个
var sceneData = NSData(contentsOfFile: path!, options: .DataReadingMappedIfSafe, error: nil)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.