Can someone tell me why I am getting
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_ScramblerModel", referenced from:
objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
My project is at This zip
Can someone tell me why I am getting Undefined symbols for architecture i386: _OBJC_CLASS_$_ScramblerModel,
Share
Your code clearly is referencing this
ScramblerModelclass, but you haven’t included theScramblerModel.mfile in your project.So, first, if you look at your
Compile Sources, it says:Go ahead and click on the “+” button at add your model. You probably want to do this for
ScramblerPlayer, too, because you use that class, as well, so if you don’t add that as well, you’ll get another linker error.Second, don’t forget to tell the app what storyboard to use:
Third, your .h has instance variables (ivars) defined for all of your
IBOutletproperties. This is a problem, because your@synthesizestatement is instantiating ivars with a leading underscore, but your .h (and your code) are referring to duplicative ivars that aren’t hooked up to anything. For example, you have a propertyremainingTime, you have a@synthesize remainingTime = _remainingTime(which is creating a_remainingTimeivar). So your explicitly declared ivarremainingTimeisn’t connected to yourremainingTimeproperty, and thus no user interface updates will result if you use that ivar, despite the similar name.You can fix the problem and simplify your code by (a) getting rid of the explicitly declared ivars for your properties; and (b) change your code to reference the property, e.g.
self.remainingTimeor the ivar_remainingTime. So, your .h is simplified and becomes:When you compile your project, you’ll get lots of errors, though, because your code was erroneously referencing those old, redundant (and misnamed) ivars. Thus, for example, in your
viewDidLoadyou had lines like:Those should be:
Just repeat this correction to everywhere you were referring to the erroneous ivars.