Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/110.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios Xcode游戏崩溃,指向SpriteNode说;EXC错误访问(代码=1,地址=0xa001800);_Ios_Xcode_Swift_Sprite - Fatal编程技术网

Ios Xcode游戏崩溃,指向SpriteNode说;EXC错误访问(代码=1,地址=0xa001800);

Ios Xcode游戏崩溃,指向SpriteNode说;EXC错误访问(代码=1,地址=0xa001800);,ios,xcode,swift,sprite,Ios,Xcode,Swift,Sprite,有几个SKNodes给了我这个问题,我声明这些节点相当标准,比如 let face = SKSpriteNode(imageNamed:"final.png")// <- this is the line it points to face.position = CGPoint(x: self.frame.size.width*0.5, y: self.frame.size.height*0.5) face.xScale = 1 face.yScale = 1 addChild(face)

有几个SKNodes给了我这个问题,我声明这些节点相当标准,比如

let face = SKSpriteNode(imageNamed:"final.png")// <- this is the line it points to
face.position = CGPoint(x: self.frame.size.width*0.5, y: self.frame.size.height*0.5)
face.xScale = 1
face.yScale = 1
addChild(face)

let face=SKSpriteNode(ImageName:“final.png”)//如果您已将图片添加为imageAsset,请在调用png时删除其结尾:

let face = SKSpriteNode(imageNamed:"final")// <- this is the line it points to

let face=SKSpriteNode(图像名为:“最终”)//发现了问题!原来问题出在我的iDevice而不是游戏中,如果有人遇到类似问题,我建议在多个iDevice上运行游戏。

确保图像与资产文件夹中的图像名称完全相同,因为通常不需要.png扩展名。如下所示:

let face = SKSpriteNode(imageNamed:"final")

你的项目中是否包含该文件?是的,我在image.xcsets文件夹和项目文件夹中都有。无论是否包含图像扩展名,该文件仍会崩溃。你是否将其添加到imageAssets中,并且名称也正确?是的,名称字母准确,但出于某种原因,它不正确工作正常文件可能有问题?或者xCode?三种不同大小的图片都有吗?
let face = SKSpriteNode(imageNamed:"final")