Game Development Reference
In-Depth Information
Figure 14-3 . Adding GameKit.framework
GameKit.framework will be added to the Linked Libraries list when you click the
Add button. By default, new libraries are added as Required, which is displayed to the
right of each library. The setting Required means your app will work only on devices
where the GameKit.framework library is available. If that's what you want, and
you've added the gamekit key to Info.plist , you can leave it at that. Otherwise,
change the setting to Optional in order to be able to run the app even on devices that
don't have Game Center available. You can account for that with a relatively simple
check in code (discussed shortly in Listing 14-3 ) and then disable any Game Kit fea-
tures in case a device doesn't support Game Kit. Cocos2d projects require Game Kit by
default, whereas Kobold2D projects have it set as optional.
Finally, you'll want the GameKit.h header file to be available in all your project's
source files. Instead of adding it to each and every source file, you should add it to your
project's Prefix.pch file. This is the precompiled header that contains header files
from external frameworks to allow the project to compile faster. But it also has the ad-
ded benefit that every header file added to the prefix header will make its definitions
available to every source code file in the current project.
You can find the Prefix.pch file in the Supporting Files group. Open the one in
your project and add the GameKit header to it, as shown in Listing 14-1 .
 
 
Search Nedrilad ::




Custom Search