Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 07-01-2011, 02:17 AM   #1 (permalink)
Registered Member
 
Join Date: Jul 2011
Posts: 3
mingakeita is on a distinguished road
Exclamation About authenticateWithCompletionHandler (Game Center)

Hello,
I have a lag problem when I use the function “authenticateWithCompletionHandler” to check the player status (log in Game Center or not)

If the player has logged in GC, the authenticateWithCompletionHandler shows the “welcome back, playerName”, and in this case, everything is OK!

Now, the problem is, when the player NOT log in GC, notification pops to create or use an existing account, or cancel. In this case, whenever the player choose which one, my game is going to lag.

Moreover, when the network is invaild, the lag problem happens, too.

The codes I use: (write in ViewDidLoad in appdelegate.m)
if( [self isGameCenterAvailable] ){
[self authenticateLocalUser];
}

- (void) authenticateLocalUser
{
[[GKLocalPlayer localPlayer] authenticateWithCompletionHandler:^(NSError *error) {
if([GKLocalPlayer localPlayer].isAuthenticated){
//upload grades here
}
}];
}

-(BOOL) isGameCenterAvailable
{
// check for presence of GKLocalPlayer API
Class gcClass = (NSClassFromString(@"GKLocalPlayer"));

// check if the device is 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);
}


P.S. If I don’t call the function “authenticateWithCompletionHandler”, the game runs smoothly without any delay

The tools I use:
cocos2d for iPhone v1.0.0,
Xcode4

what can I do to solve the lag problem? thanks


Thanks a lot
mingakeita is offline   Reply With Quote
Old 07-02-2011, 12:14 PM   #2 (permalink)
Registered Member
 
Join Date: Jul 2011
Posts: 3
mingakeita is on a distinguished road
Default

Can somebody help me to solve this problem?
mingakeita is offline   Reply With Quote
Reply

Bookmarks

Tags
authenticate, game center, network

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 341
9 members and 332 guests
apatsufas, chemistry, lendo, leostc, Leslie80, lzwasyc, MarkC, SamorodovAlex, VinceYuan
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,664
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Leslie80
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:32 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0