Follow Patrick McCarron on Twitter View Patrick McCarron's LinkedIn profile View Patrick McCarron's Flickr Photo Album View Patrick McCarron's Facebook profile

My Portfolio

Ask me a question

Archive

RSS

Patrick McCarron's
Infinite Shamrock

 

April 2
2012

How To: Use a Custom Game Center Turn Based Notification Sound

There is one thing I briefly mentioned in my post last week about the Game Center Turn Based APIs that I want to expand on a bit. While currently Game Center’s turn based push messages don’t match your app, there is an undocumented way to make the notification “sound” like you want it. The following method works on iOS 5 and 5.1 currently.

All you need to do is add a single sound file to your application bundle and iOS will automatically play that sound file when a turn/invite notification is sent to the user. The file is GKInvite and the format/extension must be either .caf, .aif or .wav.


An example GKInvite.wav from Words Play

Once this file is in your bundle, the rest will take over automatically. While this is undocumented it wont break your application if Apple changes it in the future. If you want this documented I suggest you file a similar radar to this one by me (rdar://problem/11168479) to get Apple to be more clear and add it to the documentation. Will Apple reject for this use in the future? Lets hope not and hope that the lack of documentation is just an oversight.

Thanks to fellow iOS developer Jason Lust who first posted about this sound on the Apple Dev Forums. Hope this information is helpful for developers out there using Game Center Turn Based APIs.