当我尝试使用Xcode 6在我的设备上运行我的Swift项目时,我收到了一个非常奇怪的警告.
该设备运行iOS 7.1,我的Mac正在运行Mavericks.
我在Swift和SpriteKit中编写了一个小游戏,它可以在模拟器中运行,但是当我尝试在我的设备上运行它时,我收到警告,而我的设备只显示黑色背景.
尝试运行一个新的SpriteKit项目时,我得到了相同的结果.但是,如果我使用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)