Today I realize that Apple’s GameCenter only works with iOS 4.0+… indeed I was already aware of this, but I forgot! -.-”
When I tried to test game on iPad 3.0 I received an NSException error…
I use OpenFeint in my game, but in the last release OF has included the GC support…i don’t want it! How remove it? First of all, you have to soft link the framework:
in XCode go to Project->Edit Active Target. Click on General tab, and in Linked Libraries select Weak link for GameKit.framework.
After you have to disable GC in OF settings: in the initialization, in the NSDictionary passed to OF, insert this line
[NSNumber numberWithBool:NO], OpenFeintSettingGameCenterEnabled,
NSDictionary* settings = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt:UIInterfaceOrientationLandscapeRight], OpenFeintSettingDashboardOrientation, @"APPNAME", OpenFeintSettingShortDisplayName, [NSNumber numberWithBool:YES], OpenFeintSettingEnablePushNotifications, [NSNumber numberWithBool:NO], OpenFeintSettingDisableUserGeneratedContent, [NSNumber numberWithBool:NO], OpenFeintSettingAlwaysAskForApprovalInDebug, [NSNumber numberWithBool:NO], OpenFeintSettingGameCenterEnabled, window, OpenFeintSettingPresentationWindow, nil];
Instead, if you want to check at run time whether GC is supported on that device, write this code:
Class SomeGameKitClass = NSClassFromString(@"GKAchievement"); ... [NSNumber numberWithBool:(SomeGameKitClass != NULL)], OpenFeintSettingGameCenterEnabled,
In this way, if device support GC it will enable, otherwise no 🙂 .
on iOS 4.0 GC is not fully implemented…only since iOS 4.1…you must also check this! This is a simple code that does this:
// 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);
And this is all, see you soon! 🙂