Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 32    Views: 101

Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
03/10/12 11:36 PM (13 years ago)

Game center on BT1.5

I followed MGoBlue's guide for adding game center - Thanks MGoBlue! One clarification is needed though. I seem to have coded perfectly with no errors. I have ran this on iPhone sim and iPad sim without issues.  It loads game center, I see my image and text. I don't see scores but I'm not worried about that because I've read on other forum posts that they do not show until you get 2 scores. But when I run this on my iPhone 3GS and ipad2, I get a message when the app loads saying "this game is not recognised by Game Centre"  Is this normal? - (the fact it works on Simulator but not real devices) I'm not sure if I have gone wrong somewhere or if this is normal behaviour and it starts working if apple publish app. (this app has not been submitted yet)  I added  my 'leaderboardID' (applequiz) that I created in iTunes connect only used once in Xcode. Is that correct?  In AppSpecificValues.h, mine now reads #define kLeaderboardID @"applequiz"  I feel I'm missing something stupid?  It seemed to work so well in the simulator but my phone and iPad both say "game not recognised" :( Thanks!
 
Stefan
buzztouch Evangelist
Profile
Posts: 558
Reg: Dec 21, 2010
Sweden
14,780
like
03/11/12 12:06 AM (13 years ago)
Hello. Try to remove any performer install of your app in your devices ( I assume that you have been installing them for testing purposes). Clean Xcode and reinstall you app into your iPhone/iPad. Let me know how it went. BR/Stefan
 
Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
like
03/11/12 12:56 AM (13 years ago)
Deleted app from phone and pad In Xcode Product > clean Then ran on device (whilst device connected) Same error :(
 
Stefan
buzztouch Evangelist
Profile
Posts: 558
Reg: Dec 21, 2010
Sweden
14,780
like
03/11/12 01:00 AM (13 years ago)
Have you done any changes to settings in developer.apple.com? In the Game Center section? As I understand changes might take up to 24 hours before they take effect. See this thread about same error I found googling. http://www.cocos2d-iphone.org/forum/topic/20998 BR/Stefan
 
Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
like
03/11/12 01:07 AM (13 years ago)
I set it up on developer.apple.com yesterday and it hasn't been 24 hours yet so maybe I should wait until the end of today. Just strange it shows ok in simulator? I'll take a look at your link Thanks
 
Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
like
03/11/12 01:16 AM (13 years ago)
Seems apple don't work weekends ;) I think I'll leave it and test on Monday/Tuesday Thanks
 
Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
like
03/11/12 04:25 AM (13 years ago)
Tried it on my wife's 4S and it works fine. Both my phone and ipad2 are jailbroken. After googling it seems the game center sandbox doesn't work on jailbroken devices.
 
XboxMods
buzztouch Evangelist
Profile
Posts: 718
Reg: Oct 28, 2011
location unknow...
12,080
like
03/11/12 05:55 AM (13 years ago)
I have/get that SAME error above: In AppSpecificValues.h, #define kLeaderboardID @"applequiz"
 
Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
like
03/11/12 07:05 AM (13 years ago)
You need to change the applequiz to whatever leaderboardID you created in iTunes connect. Is your device jailbroken?
 
XboxMods
buzztouch Evangelist
Profile
Posts: 718
Reg: Oct 28, 2011
location unknow...
12,080
like
03/11/12 10:03 AM (13 years ago)
I didn't run it yet, but yes my iPhone is, not my iPad. I get this error now: @implementation BT_screen_quiz -----> @end is missing in implementation context. if([buttonTitle isEqual:NSLocalizedString(@"quizSubmitScore", @"Submit Score")]) -----> Expected identifier or '('
 
Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
like
03/11/12 11:37 AM (13 years ago)
Replace all of the " if you haven't done so already
 
XboxMods
buzztouch Evangelist
Profile
Posts: 718
Reg: Oct 28, 2011
location unknow...
12,080
like
03/11/12 11:39 AM (13 years ago)
I got that error fixed, now I also have this last one error: @implementation BT_screen_quiz @end is missing in implementation context. This is in the BT_screen_quiz.m file
 
Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
like
03/11/12 12:23 PM (13 years ago)
At the end of the implementation code you should have @end. I'm guessing that's missing without seeing your code
 
XboxMods
buzztouch Evangelist
Profile
Posts: 718
Reg: Oct 28, 2011
location unknow...
12,080
like
03/11/12 12:35 PM (13 years ago)
My code: @implementation BT_screen_quiz <----- ERROR ON THIS LINE @synthesize saveAsFileName, downloader, didInit; /* quiz properties */ @synthesize quizQuestions, quizShowTimer, quizQuestionDelay, quizPointsPerAnswer, quizRandomizeQuestions; @synthesize quizButtonColorAnswers, quizButtonColorCorrect, quizButtonColorIncorrect, quizImageCornerRadius; @synthesize quizSoundEffectFileNameCorrect, quizSoundEffectFileNameIncorrect, quizSoundEffectFileNameFinished; @synthesize quizNumberOfQuestions, quizRewardIfPointsOver, quizShowCorrectAnswers, quizFontColorQuestions, quizFontColorAnswers; @synthesize scoreboardScreenName, userDisplayNameAlert, userDisplayNameField; @synthesize quizQuestionTransitionType, quizAnswersTransitionType, rotateMessageView, rotateMessageLabel; @synthesize quizQuestionFontSizeSmallDevice, quizQuestionFontSizeLargeDevice, didFinishOnce, spinner; @synthesize quizButtonFontSizeSmallDevice, quizButtonFontSizeLargeDevice, finishedButtons; /* quiz runtime properties */ @synthesize quizRunning, numberCorrect, numberIncorrect, streak, totalPoints, totalSeconds; @synthesize currentQuestionIndex, currentQuestionObject, quizDidEnd; /* quiz controls */ @synthesize startButtonBox, startButton, questionBox, answerButtonBox, paddingTop; @synthesize answerButton1, answerButton2, answerButton3, answerButton4; @synthesize answerLabel1, answerLabel2, answerLabel3, answerLabel4; @synthesize countdownToStartTimer, countdownToStartLabel, currentPointsView, currentPointsImageView; @synthesize currentPointsLabel, bonusImageView, quizTimeLabel, quizTimer, questionTransitionTimer; @synthesize questionText, questionImageView, quizToolbar; //viewDidLoad -(void)viewDidLoad{ [BT_debugger showIt:self:@"viewDidLoad"]; [super viewDidLoad]; //init screen properties [self setDidInit:0]; [self setDidFinishOnce:0]; [self setQuizDidEnd:0]; [self setPaddingTop:0];
 
Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
like
03/11/12 01:30 PM (13 years ago)
Unfortunately the quiz.m screen is Huge and we had to add and delete a fair bit. Do you have the @end at the very bottom? And you have suffucient } closing out statements?
 
XboxMods
buzztouch Evangelist
Profile
Posts: 718
Reg: Oct 28, 2011
location unknow...
12,080
like
03/11/12 01:34 PM (13 years ago)
I have the @end at the way bottom...Do you know any solutions to try? Can you check your .m file and see if there is something wrong with mine? Please
 
Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
like
03/11/12 01:36 PM (13 years ago)
I think you have too many } in the code that we had to add. Go to the sections that you added as per the PDF and make sure you have the same amount of } as you do { And we had to delete a section from that .m also so make sure you didn't leave any } behind
 
Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
like
03/11/12 01:37 PM (13 years ago)
I think you have too many } in the code that we had to add. Go to the sections that you added as per the PDF and make sure you have the same amount of } as you do { And we had to delete a section from that .m also so make sure you didn't leave any } behind
 
XboxMods
buzztouch Evangelist
Profile
Posts: 718
Reg: Oct 28, 2011
location unknow...
12,080
like
03/11/12 01:38 PM (13 years ago)
Ok, I will check all that, and get back to you soon. Thanks!
 
Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
like
03/11/12 01:38 PM (13 years ago)
Did you also remember to import .h in the import section above the implementation?
 
Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
like
03/11/12 01:44 PM (13 years ago)
heres the bits i added if you wish to copy and paste part1 //submit score if([buttonTitle isEqual:NSLocalizedString(@"quizSubmitScore", @"Submit Score")]){ [self submitScore]; } part2 //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]; } } part 3 //Submit Score Button [finishedButtons addObject:NSLocalizedString(@"quizSubmitScore", @"Submit Score")];
 
Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
like
03/11/12 01:44 PM (13 years ago)
Did you also remember to import .h in the import section above the implementation?
 
Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
like
03/11/12 01:45 PM (13 years ago)
Did you also remember to import .h in the import section above the implementation?
 
XboxMods
buzztouch Evangelist
Profile
Posts: 718
Reg: Oct 28, 2011
location unknow...
12,080
like
03/11/12 05:26 PM (13 years ago)
It still didn't fix the error.
 
Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
like
03/11/12 11:33 PM (13 years ago)
if you like, copy the complete text in bt_viewcontroller.h bt_viewcontroller.m lcalizable.string bt_screen_quiz.h bt_screen_quiz.m Appspecificvalues.h intonotepad or worddoc and then upload them somewhere where i can download, or email them to randalsp at sky dot com and i'lltake a look at them
 
Stefan
buzztouch Evangelist
Profile
Posts: 558
Reg: Dec 21, 2010
Sweden
14,780
like
03/12/12 12:12 AM (13 years ago)
@Raoul - it's better to not copy the text. Better to zip those 7 files and send them to @Bonzo or me ( we both have Xcode so it's not a problem to open the files). If you'd like I can take a look also. Mail me at sugbloggen [at] gmail dot com . We'll fix your issues ;) BR/Stefan
 
XboxMods
buzztouch Evangelist
Profile
Posts: 718
Reg: Oct 28, 2011
location unknow...
12,080
like
03/12/12 04:25 AM (13 years ago)
Thank you both, but I was up late last night and managed to fix it! @Bonzo I ran the app on my device, it says app not reconized by game center , Did you get this pop up also?
 
Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
like
03/12/12 04:42 AM (13 years ago)
I got it on my jailbroken devices but not on 'legit' devices. Game centre sandbox doesn't work on jailbroken devices
 
XboxMods
buzztouch Evangelist
Profile
Posts: 718
Reg: Oct 28, 2011
location unknow...
12,080
like
03/12/12 04:50 AM (13 years ago)
Can you send me an email, my email is [email protected] Can I send you my project and you take a look? I feel that I messed it up, and you can fix it! Please
 
Stefan
buzztouch Evangelist
Profile
Posts: 558
Reg: Dec 21, 2010
Sweden
14,780
like
03/12/12 04:54 AM (13 years ago)
@Raoul Great news to hear you solved it! BR/Stefan
 
XboxMods
buzztouch Evangelist
Profile
Posts: 718
Reg: Oct 28, 2011
location unknow...
12,080
like
03/12/12 04:56 AM (13 years ago)
@Stefan, I fixed it, but game center is still a little not working, please email me!
 
Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
like
03/12/12 05:05 AM (13 years ago)
Raoul. Let me clarify. In the simulator it works fine and opens the sandbox game centre? But when you try on the phone it says the game is not recognised? The device you are trying on, is it jailbroken?
 
XboxMods
buzztouch Evangelist
Profile
Posts: 718
Reg: Oct 28, 2011
location unknow...
12,080
like
03/12/12 05:08 AM (13 years ago)
The game center doesn't work on device and simulator, there is no banner that says welcome or sign in... I am Jailbroken, but the app still didn't work in sandbox simulator. If you have free time, please email me at [email protected] so I can send the file over. Thanks
 

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.