I am getting this crash report from my users. I am not able to reproduce it so only few devices are having this issue.
Thread : Crashed: com.apple.main-thread 0 MY_PROJECT 0x00089fb8 static MY_PROJECT.GCHelper.rematch (MY_PROJECT.GCHelper.Type)(Swift.ImplicitlyUnwrappedOptional) -> () (GCHelper.swift:156) 1 libobjc.A.dylib 0x37624a37 objc_object::sidetable_retain() + 82 2 MY_PROJECT 0x000403f0 MY_PROJECT.GameScene.ButtonFunction (MY_PROJECT.GameScene)() -> () (GameScene.swift:727) 3 MY_PROJECT 0x00052ae0 function signature specialization of MY_PROJECT.GameScene.touchesEnded (MY_PROJECT.GameScene)(Swift.Set, withEvent : ObjectiveC.UIEvent) -> () (GameScene.swift:355) 4 MY_PROJECT 0x0003d7ac @objc MY_PROJECT.GameScene.touchesEnded (MY_PROJECT.GameScene)(Swift.Set, withEvent : ObjectiveC.UIEvent) -> () (GameScene.swift) 5 SpriteKit 0x2c668755 -[SKView touchesEnded:withEvent:] + 896 6 UIKit 0x2c7fc133 -[UIWindow _sendTouchesForEvent:] + 522 7 UIKit 0x2c7f5a41 -[UIWindow sendEvent:] + 540 8 UIKit 0x2c7cbc05 -[UIApplication sendEvent:] + 196 9 UIKit 0x2ca4231f _UIApplicationHandleEventFromQueueEvent + 14538 10 UIKit 0x2c7ca607 _UIApplicationHandleEventQueue + 1350 11 CoreFoundation 0x2915722f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14 12 CoreFoundation 0x29156643 __CFRunLoopDoSources0 + 222 13 CoreFoundation 0x29154cc1 __CFRunLoopRun + 768 14 CoreFoundation 0x290a09a1 CFRunLoopRunSpecific + 476 15 CoreFoundation 0x290a07b3 CFRunLoopRunInMode + 106 16 GraphicsServices 0x3085f1a9 GSEventRunModal + 136 17 UIKit 0x2c82b695 UIApplicationMain + 1440 18 MY_PROJECT 0x00086790 main (AppDelegate.swift:16) 19 libdyld.dylib 0x37bb2aaf start + 2
Below is my rematch function from GCHelper class.
class func rematch(match:GKTurnBasedMatch!){
GCHelper.sharedInstance.rematch(match)
}
func rematch(match:GKTurnBasedMatch!){
match.rematchWithCompletionHandler({ (mMatch:GKTurnBasedMatch!, error:NSError!) -> Void in
if(error != nil){
println("\(error.description)")
} else{
println("rematch")
for var i = 0; i < mMatch.participants.count; i++ {
let participants = mMatch.participants as NSArray
let part = participants.objectAtIndex(i) as! GKTurnBasedParticipant
println("part \(i) \(part.description)")
if let playerID = part.playerID {
if(part.playerID != GKLocalPlayer.localPlayer().playerID){
self.opponentName = part.player.displayName
}
} else{
self.opponentName = "Opponent"
}
// println("participant name is \(part.playerID.)")
}
println("participant name is \(self.opponentName)")
self.delegate?.enterRematch(match,opponentName: self.opponentName)
}
})
}
And this is how I call rematch in my GameScene class.
GCHelper.rematch(self.currentTurnBasedMatch)
I don't even know at which line exactly the crash is happening. Anyone have any ideas?