Help with Objective-C code

  • Thread starter ignaciocabero
  • Start date
5 replies · 2K views · last reply
ignaciocabero
Messages
10
Reaction score
0
I've tried to figure out the problem all night, but I can't figure it out.
Screenshot of Xcode showing Objective-C code for an ICHeroClass implementation with a hero sprite, eyes, and jump method, with several error markers on lines near the bottom.
Sorry if it's hard to see.
Thank you so much,
Ignacio Cabero.
 
I've never used Objective-C, but even I can see there's something wrong with
Code:
         [[hero addChild:rightEye];
I'm pretty sure every "[" needs to be matched by a "]".
 
Thanks so much, that helped for the hero addChild, but there is still the three other ones that I need help with (the ones under the hero addChild
 
Welp, I actually fixed that problem by adding some brackets, but now this shows up.
Screenshot of Xcode showing Objective-C code for ICHeroClass, with a red error marker reading 'Expected identifier or '('' on a stray line below the jump method.
 
ignaciocabero said:
Thanks so much, that helped for the hero addChild, but there is still the three other ones that I need help with (the ones under the hero addChild

ignaciocabero said:
Welp, I actually fixed that problem by adding some brackets, but now this shows up. View attachment 72194
Some hints about errors.

  1. When one error occurs, often the following lines don't make sense to the compiler; fixing the first error may make the other errors go away.
  2. Sometimes the error isn't on the line identified by the compiler, but on the line before (e.g. something is missing from the line before, so the compiler can't make sense of the current line).
That second hint applies to the error you have now.
 
Thanks, but when I put a '( ' like it tells me to, it doesn't work.