mardi 27 janvier 2015

App crashes on iPhone 4s but no other device: possible issue with SKPhysicsContactDelegate?

I've ran my spritekit game on the following devices: iPhone 5s, iPhone 4s, iPad air and iPad mini. The app runs and all the devices except the 4s. On the 4s the app crashes when the app transitions to scenes that include SKPhysicsContactDelegate, for example:



class PlayScene: SKScene, SKPhysicsContactDelegate, ADBannerViewDelegate {


enum ColliderType: UInt32 {

case narrowCategory = 1
case bigCategory = 2
case smallCategory = 4
case roundCategory = 8

}

var narrow = SKSpriteNode(imageNamed: "Narrow")
var big = SKSpriteNode(imageNamed: "Big")

override func didMoveToView(view: SKView) {
........ }


The error message that comes up when the app crashes is: thread 1 exc_breakpoint (code=exc_arm_breakpoint, subcode = 0xe7ffdefe) .


Initially the error stopped the app at this line:



var backgroundMusicURL: NSURL = NSBundle.mainBundle().URLForResource("LevelOne", withExtension: "wav")!


When I commented out the background music the app then crashed at this line



narrow.physicsBody?.mass = 0.0001


then this



narrow.physicsBody?.allowsRotation = true


Scenes that do not use SKPhysicsContactDelegate run fine on the 4s. I also tested the 4s on the simulator and it seemingly crashes when you get to scenes using SKPhysicsContactDelegate but unlike the device an error doesn't come up, the device just blacks out and crashes without any debug sessions on xcode...does anyone have the faintest idea about what is going on here?




Aucun commentaire:

Enregistrer un commentaire