Using game center when available
I am adding Game Center features (leaderboard) to my game. Since Game Center is not a requirement for my game, I check if it is available and then use it or not.
To check if Game Center is available, instead of making direct access to GK classes (like GKLocalPlayer), NSClassFromString is used.
My question is, after determining that Game Center is supported, in the code 开发者_开发百科that will be executed only if Game Center is there (although the code will be there if Game Center is not) is there any way to use those classes directly, without using NSClassFromString for all GameKit classes I use? Currently I am doing it, and the game crashes if Game Center is not available.
Thanks in advance
It turns out that the problem was not with the Game Center references, but with the block-based methods used by Game Center.
Solution: iOS 4 app crashes at startup on iOS 3.1.3: Symbol not found: __NSConcreteStackBlock
精彩评论