trouty
I hate code!
Profile
Posts: 338
Reg: Mar 26, 2013
London Outskirt...
4,830
04/07/13 11:13 AM (12 years ago)

duplicate declaration error (gae centre in BT Quiz)

I'm getting a duplicate declaration of method 'dealloc' error, having tried to implement the game centre for BT quiz. This is the only error that i'm showing (besides a few deprecations). The error is at the foot of BT_viewController.m, i have: //dealloc - (void)dealloc { [super dealloc]; } @end Further up the page, i have: //GameCenter View Did Unload - (void)viewDidUnload { [super viewDidUnload]; // Release any retained subviews of the main view. // e.g. self.myOutlet = nil; self.gameCenterManager = nil; self.currentLeaderBoard = nil; self.currentScoreLabel = nil; } - (void)dealloc { [gameCenterManager release]; [currentLeaderBoard release]; [currentScoreLabel release]; [super dealloc]; } any ideas??
 
Absentia
buzztouch Evangelist
Profile
Posts: 960
Reg: Oct 20, 2011
Alaska
20,600
like
04/07/13 12:27 PM (12 years ago)
you can just delete the one way at the bottom - that's what I do and it seems to work fine I believe a "duplicate declaration" error pretty much always means that you are declaring the same method twice and you need to get rid of one of them I'm not sure why that tutorial adds a whole new dealloc method instead of adding to the one that's already there..probably just an oversight
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
04/07/13 01:24 PM (12 years ago)
I would say its definitely an oversight. Combine the two methods into one.
 
trouty
I hate code!
Profile
Posts: 338
Reg: Mar 26, 2013
London Outskirt...
4,830
like
04/07/13 01:35 PM (12 years ago)
ironically, removing the one at the end of the file, causes lots of errors elsewhere :o/
 
Absentia
buzztouch Evangelist
Profile
Posts: 960
Reg: Oct 20, 2011
Alaska
20,600
like
04/07/13 01:40 PM (12 years ago)
are you removing this entire block of code? - //dealloc - (void)dealloc { [super dealloc]; } If you are, what errors are you seeing?
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
04/07/13 01:40 PM (12 years ago)
Hmm - it shouldn't.
 
trouty
I hate code!
Profile
Posts: 338
Reg: Mar 26, 2013
London Outskirt...
4,830
like
04/07/13 02:26 PM (12 years ago)
hmmm... sorry guys... after a bit of ctrl-z action whilst distracted by the child... its all changed lol! i now get 'use of undeclared identfier 'setQuestionImage' //sets the question images -(void)setQuestionImage:(UIImage *)theImage{ [BT_debugger showIt:self theMessage:[NSString stringWithFormat:@"setQuestionImage: %@", @""]]; [self.spinner stopAnimating]; //do we round the corners? if(quizImageCornerRadius > 0){ theImage = [BT_imageTools makeRoundCornerImage:theImage:quizImageCornerRadius:quizImageCornerRadius]; } [self.questionImageView setImage:theImage]; [self.questionImageView setAlpha:1.0]; } I may have to wait until i can get a couple of qiet hours (no chance) and start it again :o/
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
04/07/13 02:32 PM (12 years ago)
Do you have setQuestionImage used elsewhere, like as a variable?
 
trouty
I hate code!
Profile
Posts: 338
Reg: Mar 26, 2013
London Outskirt...
4,830
like
04/07/13 02:36 PM (12 years ago)
its used a lot in that file, such as //photo finished loading.. -(void)photoDidFinishLoading:(BT_photo *)photo{ [BT_debugger showIt:self theMessage:[NSString stringWithFormat:@"photoDidFinishLoading: %@", @""]]; [self setQuestionImage:[photo image]]; } and it isnt springing up any errors elsewhere?
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
04/07/13 02:37 PM (12 years ago)
Somewhere that setQuestionImage is being used incorrectly. I would look at the debug statement right before the error to get a clue as to where
 
Absentia
buzztouch Evangelist
Profile
Posts: 960
Reg: Oct 20, 2011
Alaska
20,600
like
04/07/13 02:44 PM (12 years ago)
So I see you are in BT_screen_quiz.m now...is everything good to go in viewcontroller.m?
 
trouty
I hate code!
Profile
Posts: 338
Reg: Mar 26, 2013
London Outskirt...
4,830
like
04/07/13 02:50 PM (12 years ago)
Ummm... Not sure! It's pretty late here and head is spinning so will call it a night for now. Thanks for the input so far :-)
 
trouty
I hate code!
Profile
Posts: 338
Reg: Mar 26, 2013
London Outskirt...
4,830
like
04/09/13 12:54 PM (12 years ago)
BT_viewcontroller.m is no longer showing ANY errors, except deprecated's. The only error now showing is BT_screen_quiz.m, which is the undeclared identifier detailed above.
 
trouty
I hate code!
Profile
Posts: 338
Reg: Mar 26, 2013
London Outskirt...
4,830
like
04/09/13 01:58 PM (12 years ago)
ive moved on... i started afresh, and worked through it again. got a few errors, deleted the odd line here, //'d out a block, and the simulator is now sitting on Game Center (sandbox password) This Game is not recognised by Game Center. Presumably this is because i temporarily disable GC in itunesconnect.
 
Absentia
buzztouch Evangelist
Profile
Posts: 960
Reg: Oct 20, 2011
Alaska
20,600
like
04/09/13 02:15 PM (12 years ago)
You also need to have your bundle id set in Xcode and you need to have your dev certificates set as well
 
trouty
I hate code!
Profile
Posts: 338
Reg: Mar 26, 2013
London Outskirt...
4,830
like
04/09/13 02:29 PM (12 years ago)
page 10, change to this: //Submit Score Button [finishedButtons addObject:NSLocalizedString(@"quizSubmitScore", @"Submit Score")]; Right above: //try again button... [finishedButtons addObject:NSLocalizedString(@"quizTryAgain", @"Try Again")]; above that, is //send quiz results to URL... i've //'d that block out. also, copy/pasting from the pdf document, lots of " 's seem to need deleting and retyping, which is odd.
 
trouty
I hate code!
Profile
Posts: 338
Reg: Mar 26, 2013
London Outskirt...
4,830
like
04/09/13 02:49 PM (12 years ago)
ok, i log into gamecenter, all good. i launch my app, it says Welcome Back Trouty! all good. i take the quiz, and at the end of the last question, app crashes. bt_core/main.m int main(int argc, char *argv[]) { //return circuitguide_appDelegate as UIApplicationMain NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; int retVal= UIApplicationMain(argc,argv,@"UIApplication",@"circuitguide_appDelegate"); [pool release]; return retVal; } the 4th line, starting int retVal, Thread1:signal SIGABRT
 
trouty
I hate code!
Profile
Posts: 338
Reg: Mar 26, 2013
London Outskirt...
4,830
like
04/09/13 03:00 PM (12 years ago)
darnit!!! delete from simulator, quit simulator, clean/build and now its working :o) for now...
 

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.