1
votes

I'm almost done developing my game and it works perfectly on iOS 8, but I changed the deployment target to iOS 7.1 and tried running it on iOS 7.1 simulator, the game crashes. Any reason why is that? I have used swift as the programming language.

The error is "thread 1:signal SIGABRT"

Edit 1: It seems that it crashes when I add an SKLabelNode. here is the function which adds a score label :

var scoreLabel = SKLabelNode()

func addScoreLabel() {

    scoreLabel = SKLabelNode(text: "Score: \(score)")
    scoreLabel.fontSize = 25

    let xPos = size.width/2 //- gameOverHUD.size.width/5
    let yPos = size.height/2 //+ gameOverHUD.size.height/2 - 5

    scoreLabel.position = CGPoint(x: xPos, y: yPos)
    addChild(scoreLabel)

}

This is the complete error I get in the output console:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[SKLabelNode labelNodeWithText:]: unrecognized selector sent to class 0x10f22a3a0'

Edit 2: I was able to fix it. In case anyone is facing the same problem, simply replace the 'scoreLabel = SKLabelNode(text: "Score: (score)")' with scoreLabel.text = "Score: (score)").

1
There are many possibilities. Since you've already finished your game and there is way too much to post I would suggest going through and setting breakpoints and NSLog's to see where the problems are. Then report back and post the culprit(s). Also, in the future if you want to deploy to an earlier version I suggest setting the deployment version when you create the program and testing it on the simulator in all versions at the minimum.Scott
I edited my post with the code that is causing the issue. Please check it and let me know if you can figure out the problem.ah786

1 Answers

1
votes

check this out

https://developer.apple.com/library/prerelease/ios/documentation/SpriteKit/Reference/SKLabelNode_Ref/index.html#//apple_ref/occ/clm/SKLabelNode/labelNodeWithText:

labelNodeWithText is only available for iOS 8 and later. It wont work for iOS 7. You could instead go:

let label = SKLabelNode()  // or SKLabelNode(fontNamed: "whatever")
label.text = "hey there"