Skip to Content
Beginning iOS Game Center and Game Kit: For iPhone, iPad, and iPod touch
book

Beginning iOS Game Center and Game Kit: For iPhone, iPad, and iPod touch

by Kyle Richter
November 2011
Beginner content levelBeginner
238 pages
6h 19m
English
Apress
Content preview from Beginning iOS Game Center and Game Kit: For iPhone, iPad, and iPod touch

Watching for Status Changes

Beginning with iOS 4.0, iOS devices gained the ability for multiple apps to run simultaneously on a device. This can create some complex behavioral bugs when dealing with state, especially if the user is accessing two different Game Center–enabled apps at the same time. For example, the user may log out of Game Center, or even log in as a different user, while your app is in the background. Therefore, it is vital that you listen for changes to the local user through the NSNotification system.

Add the following snippet of code in viewDidLoad of UFOViewController.m, right after the test is performed to verify whether Game Center is available.

[[NSNotificationCenter defaultCenter]                              addObserver:self ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning ARKit for iPhone and iPad: Augmented Reality App Development for iOS

Beginning ARKit for iPhone and iPad: Augmented Reality App Development for iOS

Wallace Wang
iOS 4 in Action

iOS 4 in Action

Lin Harrington, Shannon Appelcline, Christopher R. Allen, Brandon Trebitowski
iOS 7 Development Recipes: A Problem-Solution Approach

iOS 7 Development Recipes: A Problem-Solution Approach

Joseph Hoffman, Hans-Eric Grönlund, Colin Francis, Shawn Grimes

Publisher Resources

ISBN: 9781430235279Purchase book