Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.
we want to implement Game Center in our app but also want to make the app available for users with iOS versions that don't support GC (we have an alternative solution there).
We don't understand, however, how we can compile versions for, say, 3.2 and 4.1 given the same code.
BOOL isGameCenterAvailable() { // Check for presence of GKLocalPlayer API. Class gcClass = (NSClassFromString(@\"GKLocalPlayer\"));
// The device must be running running iOS 4.1 or later. NSString *reqSysVer = @\"4.1\"; NSString *currSysVer = [[UIDevice currentDevice] systemVersion]; BOOL osVersionSupported = ([currSysVer compare:reqSysVer options:NSNumericSearch] != NSOrderedAscending);
return (gcClass && osVersionSupported); }
I feel like I have to combine these two approaches but can't figure out how. If I try to compile for version 3.2, xcode complains that it doesn't know GKLocalPlayer. Which, of course, makes sense. How can I prevent it from trying to run the code containing GKLocalPlayer etc. when compiling for older versions?
Thanks a lot for any hints!
Cheers, Bob
Post edited by Robert Paulson on
We are Gods middle children, according to Tyler Durden, with no special place in history and no special attention.
Replies
You will have to weaklink the gamecenter framework and use the isGameCenterAvailable methode to check if the gamecenter is available.
Make a donation via PayPal.
- Spam
- Abuse
- Troll
0 · Off Topic Insightful Disagree Dislike Like Awesome