开发者

Gamecenter crash when I check if player is logged in

开发者 https://www.devze.com 2023-04-12 11:50 出处:网络
I have a crash on this line with bad acce开发者_JAVA技巧ss. if([GKLocalPlayer localPlayer].authenticated == YES)

I have a crash on this line with bad acce开发者_JAVA技巧ss.

if([GKLocalPlayer localPlayer].authenticated == YES) 

I saw this code on several tutorials and I think it should work. Do I need to enable something before calling it?

EDIT: The crash is upper, on this line - I just separated the calls

player = [GKLocalPlayer localPlayer];


The getter is called isAuthenticated not authenticated. Use the following:

if ([GKLocalPlayer localPlayer].isAuthenticated == YES) 

There are more details in Apple's Game Center User Guide


This line:

player = [GKLocalPlayer localPlayer];

crashed because there was no autorelease memory pool in place before the call. Weird crash...

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号