Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 9    Views: 94

I mean it
Code is Art
Profile
Posts: 66
Reg: Feb 20, 2012
London
1,060
03/18/12 04:09 AM (13 years ago)

Failed Build after attempted Game Center integration

Hi All, Oh dear! Looks like I messed up! Followed MGoBlue's How-to to the T, yet the build fails :( 1) I get "expected filename" in the import "GameCenterManager.h" line 2) I get "cannot find protocol declaration for GameCenterManagerDelegate" Any help would be greatly appreciated! Best wishes, Dan THIS IS WHAT IT LOOKS LIKE: #import “GameCenterManager.h” @class GameCenterManager; @interface BT_viewController : UIViewController <UIAlertViewDelegate, ADBannerViewDelegate, ADBannerViewDelegate, UIActionSheetDelegate, GKLeaderboardViewControllerDelegate, GKAchievementViewControllerDelegate, GameCenterManagerDelegate>{
 
shak77
buzztouch Evangelist
Profile
Posts: 399
Reg: Jan 18, 2011
location unknow...
7,240
like
03/18/12 06:35 AM (13 years ago)
MGoBlue had this problem in the first version of the tutorial which you must be using. There is a more updated version on his website. The " marks you're using are curly not straight. Go through the code you pasted into Xcode from MGoBlue's tutorial and just delete the " marks and retype them. You'll notice the difference.
 
I mean it
Code is Art
Profile
Posts: 66
Reg: Feb 20, 2012
London
1,060
like
03/18/12 07:48 AM (13 years ago)
Hi Shak77, Thanks so much for your help. You were absolutely right, the curly marks needed to be replaced! However, it still fails to build and now I have the following issues: Expected external declaration Expected identifier or } Initializer element is not compile-time constant All these issues (7) occur in the BT_screen_quiz.m file in the section below: Again, hope any of you will be able to help. Best regards, Dan //submit score -(void)submitScore{ if(totalPoints > 0) { [self.gameCenterManager reportScore: totalPoints forCategory: self.currentLeaderBoard]; } GKLeaderboardViewController *leaderboardController = [[GKLeaderboardViewController alloc] init]; if (leaderboardController != NULL) { leaderboardController.category = self.currentLeaderBoard; leaderboardController.timeScope = GKLeaderboardTimeScopeWeek; leaderboardController.leaderboardDelegate = self; [self presentModalViewController: leaderboardController animated: YES]; } } //show scoreboard -(void)showScoreboard{ GKLeaderboardViewController *leaderboardController = [[GKLeaderboardViewController alloc] init]; if (leaderboardController != NULL) { leaderboardController.category = self.currentLeaderBoard; leaderboardController.timeScope = GKLeaderboardTimeScopeWeek; leaderboardController.leaderboardDelegate = self; [self presentModalViewController: leaderboardController animated: YES]; } } //show quiz reward screen
 
shak77
buzztouch Evangelist
Profile
Posts: 399
Reg: Jan 18, 2011
location unknow...
7,240
like
03/18/12 08:10 AM (13 years ago)
Hmmmm. I'm not great with this. The reason I knew about the curly quotes was because I had that problem a few weeks ago. I would try cleaning Xcode (shift-command-K), then try running in the simulator and see what happens. After that, you need to probably have someone look over your code.
 
I mean it
Code is Art
Profile
Posts: 66
Reg: Feb 20, 2012
London
1,060
like
03/18/12 10:26 AM (13 years ago)
Thanks for the reply, Shak77. I tried cleaning - no success. I'm still hoping someone may have a solution... Best wishes, Dan
 
Stefan
buzztouch Evangelist
Profile
Posts: 558
Reg: Dec 21, 2010
Sweden
14,780
like
03/18/12 01:38 PM (13 years ago)
Hi Dan You must have a line break after the "//submit score". Like this //submit score -(void)submitScore{ if(totalPoints > 0) { [self.gameCenterManager reportScore: totalPoints forCategory: self.currentLeaderBoard]; } GKLeaderboardViewController *leaderboardController = [[GKLeaderboardViewController alloc] init]; if (leaderboardController != NULL) { leaderboardController.category = self.currentLeaderBoard; leaderboardController.timeScope = GKLeaderboardTimeScopeWeek; leaderboardController.leaderboardDelegate = self; [self presentModalViewController: leaderboardController animated: YES]; } } BR/Stefan
 
I mean it
Code is Art
Profile
Posts: 66
Reg: Feb 20, 2012
London
1,060
like
03/18/12 02:04 PM (13 years ago)
Woohoo, thank you Stefan, 3 Errors less! I've only got 3 errors left, in the remaining part of the earlier posted code (see below) those 3 errors are: 1) "Initializer element is not compile-time constant" in [[GKLeaderboardViewController alloc] init]; 2) "Expected identifier or {" red underlined: "if if (leaderboardController != NULL) { 3) "Expected external declaration: }" ({ red underlined) Here the code without the error messages: GKLeaderboardViewController *leaderboardController = [[GKLeaderboardViewController alloc] init]; if (leaderboardController != NULL) { leaderboardController.category = self.currentLeaderBoard; leaderboardController.timeScope = GKLeaderboardTimeScopeWeek; leaderboardController.leaderboardDelegate = self; [self presentModalViewController: leaderboardController animated: YES]; } } //show scoreboard -(void)showScoreboard{ GKLeaderboardViewController *leaderboardController = [[GKLeaderboardViewController alloc] init]; if (leaderboardController != NULL) { leaderboardController.category = self.currentLeaderBoard; leaderboardController.timeScope = GKLeaderboardTimeScopeWeek; leaderboardController.leaderboardDelegate = self; [self presentModalViewController: leaderboardController animated: YES]; } } //show quiz reward screen
 
I mean it
Code is Art
Profile
Posts: 66
Reg: Feb 20, 2012
London
1,060
like
03/18/12 02:10 PM (13 years ago)
Wooohoooo, Stefan, it's all sorted!! Thank you so much! It was driving me crazy all day! Everything fine now!! Best wishes, Dan
 
Stefan
buzztouch Evangelist
Profile
Posts: 558
Reg: Dec 21, 2010
Sweden
14,780
like
03/18/12 02:49 PM (13 years ago)
Great news! I know it's frustrating when your'e so close at it. Glad I could help. Just a heads up -before submitting to App store make sure that you have erased all the test data in your leader board. You do that it in Game Center area att developer.apple.com BR/Stefan
 
I mean it
Code is Art
Profile
Posts: 66
Reg: Feb 20, 2012
London
1,060
like
03/18/12 02:59 PM (13 years ago)
Great Advice, Stefan! Will do. Thanks a lot again! Best wishes, Dan
 

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.