Search code examples
iosobjective-csingletonampersand

Xcode Singleton Undeclared Identifier amp


I'm following a tutorial on creating a weather app for iOS. After a while, I've encountered an error which is dispatch_once(&onceToken, ^{ use of undeclared identifier 'amp'.

Can anyone tell me why this is happening? This is the tutorial:
Building a Weather Application


Solution

  • The tutorial has an error in its formatting, and is showing an & as an HTML literal. Change the code to dispatch_once(&onceToken, ^{ and you'll be golden.