All online tutorials say to make this function but I dont know where to put it and it gets a lot of errors.
void showAchievements()
{
//if (hasGameCenter)
GKAchievementViewController *achievements = [[GKAchievementViewController alloc] init];
if (achievements != nil)
{
achievements.achievementDelegate = self;
// Create an additional UIViewController to attach the GKAchievementViewController to
UIViewController *myViewController = [[UIViewController alloc] init];
// Add the temporary UIViewController to the main OpenGL view
[[[CCDirector sharedDirector] openGLView] addSubview:myViewController.view];
[myViewController presentModalViewController:achievements animated:YES];
}
[achievements release];
}
It doesn’t like the part about ‘self’. Sorry I’m new to obj-c so I’m having a hard time. I’m already authenticating the player properly and giving achievements I just cant get the achievement view to work. Thanks everyone.
I’m already mixing c++ and obj-c using a .mm file but I don’t fully understand obj-c. Do you mind showing me how this code should be so I can learn from you? Thank you.
SimpleAudioEngine shows how to mix c++ and obj-c which I’m already doing fine. My issue is with the function listed in my original post. How can I rewrite the above function to work with cocos2d-x director?
This works, however while in the achievement view page if I tap around on the screen then close the window when my game returns to view the iPhone keyboard will pop up and wont go away. I have to restart the app to get rid of the keyboard. Does anyone know why this might be happening? Thanks a million!
Weird thing is, I don’t even have any text boxes in my project so I have no idea why the keyboard even thinks it’s supposed to pop up in the first place.
Joseph - thanks for the help, you’ve solved my problem!
One thing though, what is the difference between putting a + or - before the function names? I’ve noticed that you get different results using each, and sometimes even errors, or callbacks that don’t get called. Is it a private/public type of identifier or something?