Why am I getting an "Expected Identifier" error?

Objective-C – Expected identifier error driving me crazy

  • I'm getting an expected identifier error when I try to compile my code. careerURL is setup like this in .h file: @property (nonatomic, copy) NSString *careerURL; And synthesized like this in .m file: @synthesize careerURL; I really do not understand what is the issue here. The exact code works in another viewcontroller.

  • Answer:

    You should either use dot(.) syntax, NSString *wtf = self.careerURL; Or Objective-C message syntax, NSString *wtf = [self careerURL]; Not both at the same time.

Peter Warbo at Stack Overflow Visit the source

Was this solution helpful to you?

Other answers

You should write: NSString *wtf = self.careerURL; When you are writing [object method] it is expected that you want to call method method from object object. If you want just access some value (that is defined as @property) you can type: [self nameOfValue]; or self.nameOfValue;

Nekto

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.