我有一个在设备上测试时运行良好的应用程序,但是在提交给 Apple 审查后,我被告知该应用程序在启动时崩溃。对符号化崩溃日志的进一步调查表明,以下函数有问题(第 131 行:self.highScore = leaderboardRequest.localPlayerScore.value)
有人以前看过这个吗?我认为它与 64 位架构有关,但我无法复制该错误。
func getHighScore(leaderBoardId: String) {
let localPlayerID = GKLocalPlayer.localPlayer().playerID
let leaderboardRequest = GKLeaderboard(playerIDs: [localPlayerID]) as GKLeaderboard!
leaderboardRequest.identifier = leaderBoardId
if leaderboardRequest != nil
{
leaderboardRequest.loadScoresWithCompletionHandler({ (scores:[AnyObject]!, error:NSError!) -> Void in
if error != nil
{
//handle error
log.debug("error retrieving score")
}
else
{
log.debug("here we go: \(leaderboardRequest.localPlayerScore.value)")
self.highScore = leaderboardRequest.localPlayerScore.value //line 131
NSNotificationCenter.defaultCenter().postNotificationName(AUTHENTICATED_NOTIFICATION, object: self)
}
})
}
}
崩溃日志如下:
{"app_name":"MyGameApp","app_version":"1.1","bundleID":"com.aaapps.MyGameApp","adam_id":933686335,"os_version":"iPhone OS 8.1.1 (12B435)","slice_uuid":"00f078c2-cb60-3dec-b4d5-27187cb55a13","share_with_app_devs":false,"build_version":"1","is_first_party":false,"bug_type":"109","name":"MyGameApp"}
Incident Identifier: 5010EF12-A30A-41E2-9FEA-2335C25EB3DC
CrashReporter Key: e3d10d2ccd5af0e83a5e75453e737ab344eca9e4
Hardware Model: xxx
Process: MyGameApp [2917]
Path: /private/var/mobile/Containers/Bundle/Application/D3BD0802-4F20-4C10-AC6A-E0EACECFEE44/MyGameApp.app/MyGameApp
Identifier: com.aaapps.MyGameApp
Version: 1 (1.1)
Code Type: ARM-64 (Native)
Parent Process: launchd [1]
Date/Time: 2014-12-01 09:56:07.167 -0800
Launch Time: 2014-12-01 09:56:01.608 -0800
OS Version: iOS 8.1.1 (12B435)
Report Version: 105
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x00000001002682e0
Triggered by Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libswiftCore.dylib 0x00000001002682e0 _TFSs18_fatalErrorMessageFTVSs12StaticStringS_S_Su_T_ + 144
1 libswiftCore.dylib 0x00000001002682dc _TFSs18_fatalErrorMessageFTVSs12StaticStringS_S_Su_T_ + 140
**2 MyGameApp 0x00000001000f8c48 MyGameApp.GameKitHelper.(getHighScore (MyGameApp.GameKitHelper) -> (Swift.String) -> ()).(closure #1) (GameKitHelper.swift:131)**
3 MyGameApp 0x00000001000f9060 reabstraction thunk helper from @callee_owned (@owned [Swift.AnyObject]!, @owned ObjectiveC.NSError!) -> (@unowned ()) to @callee_owned (@in ([Swift.AnyObject]!, ObjectiveC.NSError!)) -> (@out ()) (GameKitHelper.swift:123)
4 MyGameApp 0x00000001000f3188 partial apply forwarder for reabstraction thunk helper from @callee_owned (@owned [Swift.AnyObject]!, @owned ObjectiveC.NSError!) -> (@unowned ()) to @callee_owned (@in ([Swift.AnyObject]!, ObjectiveC.NSError!)) -> (@out ()) (GameKitHelper.swift:0)
5 MyGameApp 0x00000001000f9088 reabstraction thunk helper from @callee_owned (@in ([Swift.AnyObject]!, ObjectiveC.NSError!)) -> (@out ()) to @callee_owned (@owned [Swift.AnyObject]!, @owned ObjectiveC.NSError!) -> (@unowned ()) (GameKitHelper.swift:0)
6 MyGameApp 0x00000001000f91f8 reabstraction thunk helper from @callee_owned (@owned [Swift.AnyObject]!, @owned ObjectiveC.NSError!) -> (@unowned ()) to @callee_unowned @objc_block (@unowned ObjectiveC.NSArray!, @unowned ObjectiveC.NSError!) -> (@unowned ()) (GameKitHelper.swift:123)
7 GameCenterFoundation 0x000000018d45e3c0 __39-[GKDispatchGroup