How to add a framework to fix undefined symbols errors such as "_OBJC_CLASS_$_CAGradientLayer"
One common error that can frequently come up when starting on a new project is an undefined symbol error. Most likely cause? forgot to include a framework in your project. For the “_OBJC_CLASS_$_CAGradientLayer” undefined symbol, it is forgetting to include the QuartzCore framework. To add a framework to your project in XCode:
- Make sure your target is selected in the main view
- Select the “Build Phases” tab
- Click the arrow to the left of the “Link Binary With Libraries” row
- Click the plus button/
- Type “QuartzCore” or any other framework you wish to add into the search field
- Double click the “QuartzCore.framework” to add it to your project
The framework will then appear in the left pane. I always like to move it to the frameworks folder to avoid clutter.