Why Does Use of Undeclared Identifier 'touchesBegan' Error Occur in Objective-C?

  • Thread starter Thread starter ignaciocabero
  • Start date Start date
Click For Summary

Discussion Overview

The discussion revolves around an error encountered in Objective-C while developing an iOS game, specifically regarding the use of the method 'touchesBegan'. Participants explore potential reasons for the error message indicating an undeclared identifier.

Discussion Character

  • Technical explanation, Debate/contested, Homework-related

Main Points Raised

  • Ignacio Cabero describes encountering an error related to the 'touchesBegan' method in their iOS game development.
  • One participant suggests that the issue may be due to a missing closing brace in the function definition.
  • Another participant challenges the closing brace suggestion, stating that it is visible in the thumbnail and proposes that the function name might be incorrect, suggesting 'touchesBegin' as a possible alternative.
  • Ignacio Cabero responds that trying 'touchesBegin' did not resolve the issue.
  • Ignacio expresses gratitude to the participants for their assistance.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the cause of the error, with differing views on whether the issue is related to the function name or the structure of the code.

Contextual Notes

There is uncertainty regarding the correct function name and the overall structure of the code, as well as the visibility of the closing brace, which may affect the discussion.

ignaciocabero
Messages
10
Reaction score
0
Hello, I am making an iOS game, written in Objective-C, but I have recently encountered a problem. If you can help me, I would appreciate it a lot.
ImageUploadedByPhysics Forums1408081969.744984.jpg
If it's hard to read, it say
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {The problem says
"Use of undeclared identifier 'touchesBegan'"

Thank you,
Ignacio Cabero
 
Technology news on Phys.org
I think the function above it is missing a closing brace }
 
willem2 said:
I think the function above it is missing a closing brace }

I don't think that's it. I see the closing brace in the thumbnail.

Could it be that you have the wrong function name? Should it be touchesBegin instead? Check the iOS or other appropriate documentation to make sure you're using the correct function names.
 
I already tried touchesBegin :( I get it to work.
 
Thank you guys so much. As a beginner developer, thank you so much
 

Similar threads

  • · Replies 70 ·
3
Replies
70
Views
5K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 14 ·
Replies
14
Views
3K
Replies
5
Views
2K
  • · Replies 13 ·
Replies
13
Views
2K
Replies
1
Views
2K
Replies
73
Views
6K
  • · Replies 17 ·
Replies
17
Views
7K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 3 ·
Replies
3
Views
4K