Really sorry - I just found out the code that has been given to me to work on is running Sparrow 2. So the simple resolution was to use currentcontroller.view:
UIViewController *leaderboardParentViewController = [[UIViewController alloc] init];
[Sparrow.currentController.view addSubview:leaderboardParentViewController.view];
however now I am getting a warning. Here is the method in full:
-(void)showLeaderBoard
{
GKLeaderboardViewController *leaderboardController = [[GKLeaderboardViewController alloc] init];
if (leaderboardController != nil)
{
leaderboardController.category = @"JPMHJ1";
leaderboardController.timeScope = GKLeaderboardTimeScopeAllTime;
leaderboardController.leaderboardDelegate = self;
UIViewController *leaderboardParentViewController = [[UIViewController alloc] init];
[Sparrow.currentController.view addSubview:leaderboardParentViewController.view];
[leaderboardParentViewController presentModalViewController:leaderboardController animated:YES];
}
the warning appears at "leaderboardController.leaderboardDelegate = self;"
the warning is: "Assigning to 'id<GKLeaderboardViewControllerDelegate>' from incompatible type 'InGame *const __strong'"
I seem to be able to get the gamecenter up if I do:
leaderboardController.leaderboardDelegate = Sparrow.currentController.delegate;
however then I still get the warning:
Assigning to 'id<GKLeaderboardViewControllerDelegate>' from incompatible type 'id<GLKViewControllerDelegate>'
and I am not sure now. I hope my resolution to my original issue helps someone although checking the version of the framework should have been the first thing I did!
any input is appreciated on the proper way to assign the delegate is much appreciated.
Thanks,
David