nihalahmed / GameCenterManager

iOS Game Center helper singleton
Other
715 stars 127 forks source link

Error on: resetAchievementsWithCompletion: #37

Closed RoLYroLLs closed 9 years ago

RoLYroLLs commented 9 years ago

Using Xcode 6.3.2 with deployment target of 8.2, whenever I call the resetAchievementsWithCompletion: function I get:

*** Terminating app due to uncaught exception 'GameKit Exception', reason: 'expected GKPlayer, got G:297795793 ([player isKindOfClass:[GKPlayer class]])
[__60-[NSArray(GKPlayerCanonicalization) _gkInternalsFromPlayers]_block_invoke (GKPlayer.m:662)]'
*** First throw call stack:
(
    0   CoreFoundation                      0x0000000104502c65 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x000000010419bbb7 objc_exception_throw + 45
    2   CoreFoundation                      0x0000000104502b9d +[NSException raise:format:] + 205
    3   GameCenterFoundation                0x0000000110eac2b2 __60-[NSArray(GKPlayerCanonicalization) _gkInternalsFromPlayers]_block_invoke + 221
    4   GameCenterFoundation                0x0000000110e73883 __49-[NSArray(GKCollectionUtils) _gkFilterWithBlock:]_block_invoke + 16
    5   CoreFoundation                      0x000000010444c026 __53-[__NSArrayI enumerateObjectsWithOptions:usingBlock:]_block_invoke + 70
    6   CoreFoundation                      0x000000010444bf5c -[__NSArrayI enumerateObjectsWithOptions:usingBlock:] + 284
    7   GameCenterFoundation                0x0000000110e73863 -[NSArray(GKCollectionUtils) _gkFilterWithBlock:] + 136
    8   GameCenterFoundation                0x0000000110e8dd9b -[GKLeaderboard scoreRequestForGame:] + 50
    9   GameCenterFoundation                0x0000000110e8e07b __57-[GKLeaderboard loadScoresForGame:withCompletionHandler:]_block_invoke + 44
    10  GameCenterFoundation                0x0000000110ee2a1d -[GKDispatchGroup perform:] + 511
    11  GameCenterFoundation                0x0000000110e8dfe5 -[GKLeaderboard loadScoresForGame:withCompletionHandler:] + 202
    12  HLCY TapIt                          0x000000010211ae1b __35-[GameCenterManager syncGameCenter]_block_invoke174 + 1051
    13  libdispatch.dylib                   0x00000001076f0186 _dispatch_call_block_and_release + 12
    14  libdispatch.dylib                   0x000000010770f614 _dispatch_client_callout + 8
    15  libdispatch.dylib                   0x00000001076f9552 _dispatch_root_queue_drain + 1768
    16  libdispatch.dylib                   0x00000001076fab17 _dispatch_worker_thread3 + 111
    17  libsystem_pthread.dylib             0x0000000107a7c637 _pthread_wqthread + 729
    18  libsystem_pthread.dylib             0x0000000107a7a40d start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException

Please let me know how to better collect debug information to help diagnose. I'm not very familiar with the best way. I did find that when I comment out [self syncGameCenter] (https://github.com/nihalahmed/GameCenterManager/blob/master/GC%20Manager/GameCenterManager.m#L1001) the error doesn't occur.

Will try to look further into this issue.

RoLYroLLs commented 9 years ago

I found out the problem. In iOS8 - (instancetype)initWithPlayerIDs:(NSArray *)playerIDs where playerIDs is An array of NSString objects that holds the player identifier strings of the players to retrieve., is depreciated. Xcode suggested to use - (instancetype)initWithPlayers:(NSArray *)players where players is An array of GKPlayer objects that holds the player identifiers to be retrieved. I changed the method in GCM but did not change the data in the NSArray. I will submit a pull request so that is iOS 8 is detected it will use the new method.