Friend List Avatars

iOS 5.0 adds support for friends' avatars. Players are required to set their avatar in the Game Center app. If they have not set an avatar, Game Center will assign them a default avatar. To access avatars in your app, you will need to be running on iOS 5.0 or newer, and you will need to implement one new method. The following method is called on an existing GKPlayer object (see the previous section for more information on GKPlayer). There are two options for avatar image sizes: GKPhotoSizeNormal and GKPhotoSizeSmall. As of iOS 5.0 beta 4, they are undefined sizes, so you will need to experiment with them to see which offers the image size you need.

[player loadPhotoForSize:GKPhotoSizeNormal withCompletionHandler: ^(UIImage ...

Get Beginning iOS Game Center and Game Kit: For iPhone, iPad, and iPod touch now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.