Why is Xcode not finding a framework header file?

This seems really basic! I started a new project to begin exploring Metal. In some frameworks Xcode is finding the header files as I would expect, but the CAMetalLayer.h is just not there (according to the error).


If the screenshots aren't showing up in the forum display, I'll try to wordsmith descriptions of what they show.


I have added the frameworks (Project -> Target -> Linked Frameworks and Libraries: QuartzCore.framework, Metal.framework):


They show fine in the project navigator (Frameworks -> QuartzCore.framework -> Headers -> CAMetalLayer.h):


But Xcode isn't offering them up (auto-completion suggests "QuartzCore/" and "QuartzCore/QuartzCore.h"):



And if I try to tell it what to look for, that doesn't work, but a drag and drop of the header file into the source code does... and is fragile by the SDK version:

// Doesn't work:
#import <QuartzCore/CAMetalLayer.h> 'QuartzCore/CAMetalLayer.h' file not found

// Does work:
#import "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/CAMetalLayer.h"



I haven't done anything to the search paths:


Project -> Targets -> Build Settings -> Search Paths -> Framework Search Paths: nothing!


Just in case: Project=> Targets -> Build Settings -> Search Paths -> nothing there, either!

Answered by OOPer in 76132022

As far as I tested, some headers got hidden when you build for Metal-unavailable targets -- iOS Simulator.

Does that issue happen for actual devices?

I have the same missing file problem in Apple's example code MetalBasic3D; MacBook Pro (Retina, 13-inch, Late 2013); OSX 10.11; Xcode 7.0.1

Accepted Answer

As far as I tested, some headers got hidden when you build for Metal-unavailable targets -- iOS Simulator.

Does that issue happen for actual devices?

I think that's what I discovered also.

this answer is not correct. I am testing on a new iPad Pro 9.7 and the error still happens. This has nothing to do with compiliing for simulator or device.

Why is Xcode not finding a framework header file?
 
 
Q