Cannot find protocol declaration for 'CALayerDelegate'.

I am upgrading an old IOS app to work with IOS 10. After I updated xcode to 8.2 and try biuld, I get this error - Cannot find protocol declaration for 'CALayerDelegate'.

I am at a loss as to what I am missing in my program to resolve this.

Thanks.

Replies

CALayerDelegate is in QuartzCore.


You probably acidentally broke your imports when you upgraded your project. Add it back to the places that are complaining, and double check your project library settings.

Thank you.


The error is in UIView.h from UIKit. The following is the imports section.


#import <Foundation/Foundation.h>

#import <QuartzCore/QuartzCore.h>

#import <UIKit/UIResponder.h>

#import <UIKit/UIInterface.h>

#import <UIKit/UIKitDefines.h>

#import <UIKit/UIAppearance.h>

#import <UIKit/UIDynamicBehavior.h>

#import <UIKit/NSLayoutConstraint.h>

#import <UIKit/UITraitCollection.h>

#import <UIKit/UIFocus.


The reference is in this area of code in the same UIView.h file.

NS_CLASS_AVAILABLE_IOS(2_0) @interface UIView : UIResponder <NSCoding, UIAppearance, UIAppearanceContainer, UIDynamicItem, UITraitEnvironment, UICoordinateSpace, UIFocusItem, CALayerDelegate>


Do I maybe have an old QuartzCore.h that it is referencing?

Probably it's different because the system frameworks are generally modules now. I'd suggest you simply replace all of the above with one line:


     @import UIKit;


Note that importing the entire module is likely to be faster than imported non-modular pieces of it. (Welcome to the 21st century!)

Thanks so much for your help.


I tried editing the file, but it said it was locked. So that led me to look at where the file was located, which was with the Apple library files of course. But as I was looking for that I noticed that there was a Quartz file in my project folder as well. I'm thinking that when I wrote this program way back when, I must have copied the Quartz folder to my project for some reason, rather than referencing it, so it was looking at that older file first. I simply deleted that file from my project folder and it compiled fine.


Thanks for your suggestions - helped me to look at the files more closely!

Hi


Facing same issue. Error is in UIView.h, which is not editable. I checked my whole project, there is no Quartz file in my project unlike @avfadagio. Any help will be appreciated