相关疑难解决方法(0)

Swift和Spritekit不会在运行iOS 7.1的设备上运行

当我尝试使用Xcode 6在我的设备上运行我的Swift项目时,我收到了一个非常奇怪的警告.

该设备运行iOS 7.1,我的Mac正在运行Mavericks.

我在Swift和SpriteKit中编写了一个小游戏,它可以在模拟器中运行,但是当我尝试在我的设备上运行它时,我收到警告,而我的设备只显示黑色背景.

尝试运行一个新的SpriteKit项目时,我得到了相同的结果.但是,如果我使用Swift运行一个新的单页应用程序,它会正常运行.

这是我收到的警告:

在此输入图像描述

有什么建议?

sprite-kit swift xcode6

11
推荐指数
2
解决办法
4093
查看次数

SKPhysicsBody的Swift便利初始化程序扩展

extension SKPhysicsBody {

    /// anchorPoint version of init(rectangleOfSize:center:)
    convenience init(rectangleOfSize s: CGSize, withAnchorPoint anchorPoint: CGPoint) {
        var center = CGPoint()
        center.x = (s.width / 2) - ( s.width * anchorPoint.x)
        center.y = (s.height / 2 ) - ( s.height * anchorPoint.y)
        self.init(rectangleOfSize: s, center: center)
    }

}
Run Code Online (Sandbox Code Playgroud)

我在运行时遇到了这个错误

-[PKPhysicsBody initWithRectangleOfSize:withAnchorPoint:]: unrecognized selector sent to instance 0x7f9b03c4fff0

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[PKPhysicsBody initWithRectangleOfSize:withAnchorPoint:]: unrecognized selector sent to instance 0x7f9b03c4fff0'
Run Code Online (Sandbox Code Playgroud)

这是我在代码中调用的方式

// redBox is a typical SKSpriteNode() …
Run Code Online (Sandbox Code Playgroud)

sprite-kit swift swift-extensions

3
推荐指数
1
解决办法
225
查看次数

标签 统计

sprite-kit ×2

swift ×2

swift-extensions ×1

xcode6 ×1