WallE
Aspiring developer
Profile
Posts: 73
Reg: Jan 29, 2012
Burlington, Can...
2,880
05/06/13 01:55 PM (12 years ago)

Game Center 'authenticateWithCompletionHandler' depreciated warning

I've integrated the Quiz plugin with Game Center and because I require a deployment target of iOS 6.0 I get the following warning about the 'authenticateWithCompletionHandler' being depreciated as of iOS 6.0: "authenticateWithCompletionHandler: is depreciated: first depreciated in iOS 6.0" Although it's only a warning and the Quiz can still submit scores to Game Center I would like to update this code function to be ready for iOS 7.x in case it stops working. Has anyone been able to recode the following section from 'GameCenterManager.m' file to the new format (I've tried based on Google searches but with no success): - (void) authenticateLocalUser { if([GKLocalPlayer localPlayer].authenticated == NO) { [[GKLocalPlayer localPlayer] authenticateWithCompletionHandler:^(NSError *error) { [self callDelegateOnMainThread: @selector(processGameCenterAuth:) withArg: NULL error: error]; }]; } } Thank you to anyone with assistance.
 
WallE
Aspiring developer
Profile
Posts: 73
Reg: Jan 29, 2012
Burlington, Can...
2,880
like
05/06/13 02:01 PM (12 years ago)
Sorry, Xcode actually calls it 'deprecated' (not depreciated).
 
theMonster
Code is Art
Profile
Posts: 435
Reg: Oct 18, 2011
US
8,050
like
05/06/13 03:06 PM (12 years ago)
Yeah you now have to present the GC login VC manually in iOS 6 instead of implicitly with that command. That's why it's deprecated. So you'll want to do something like this in your authentication method: localPlayer.authenticateHandler = ^(UIViewController *vc, NSError *error) { if(viewController) { [self presentViewController:vc];//present the login } else { // an error occurred } };
 
WallE
Aspiring developer
Profile
Posts: 73
Reg: Jan 29, 2012
Burlington, Can...
2,880
like
05/07/13 01:11 PM (12 years ago)
Ya, I found code similar to that as well but when I try you code snippet I get other warnings like "Instance method '-presentViewController:' not found (return type defaults to 'id')" for the 'presentViewController:vc' reference. I'll continue to play with it.
 
Jake Chasan
Veteran developer
Profile
Posts: 1685
Reg: May 13, 2011
location unknow...
29,650
like
06/05/13 02:58 PM (12 years ago)
@WallE: Have you figured it out? Jake
 
WallE
Aspiring developer
Profile
Posts: 73
Reg: Jan 29, 2012
Burlington, Can...
2,880
like
06/06/13 08:51 AM (12 years ago)
Hi Jake, No. I found info on this subject on StackOverFlow but haven't been able to get it working correctly. It's no just a one line change like a lot of iOS deprecated code snippets. Kirk
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.