Unable to compile code that uses AVFoundation on WatchSimulator because of an invalid header check

Originator:steipete
Number:rdar://29131674 Date Originated:06-Nov-2016 10:12 PM
Status:Open Resolved:
Product:watchOS Product Version:
Classification:Serious Bug Reproducible:Always
 
Peter Steinberger06-Nov-2016 10:12 PM


Summary:
AVFoundation.h checks for watchOS via the existance of <AVFoundation/AVAnimation.h>. This file does not exist for watchOS, but does exist in watchSimulator, resulting in compile errors.

Steps to Reproduce:
Take any watchOS project. Include AVFoundation. Observe that it now compiles on watchOS, but fails in watchSimulator with 'CoreMedia/CMTime.h' file not found

Expected Results:
Any code that compiles on watchOS should also compile on watchSimulator

Actual Results:
watchSimulator can't compile code wheras watchOS as target can do.

Version:
watchOS 3.1

Notes:
This has been observed by other people as well. https://forums.developer.apple.com/thread/64649

We simply delete the file manually to patch up watchSimilator. There are more bugs so the patch is a bit larger. https://gist.github.com/steipete/fc633fe4ac812f5c696c3db6554509a9

Configuration:
Xcode 8.1GM

Attachments:

Comments

See the code here:

import

if TARGET_OS_WATCH

if ! _hasinclude()

define AVF_IS_WATCHOS_SDK 1

endif

endif

Unfortunately, AVAnimation.h does exist in the Simulator...

steipete@steipete-rmbp ~/Documents/Projects/Viewer-iOS/Viewer/Vendor/PSPDFKit/iOS/Resources (master) $ locate AVAnimation.h /Applications/Xcode-beta.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVAnimation.h /Applications/Xcode-beta.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVAnimation.h /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/AVFoundation.framework/Versions/A/Headers/AVAnimation.h /Applications/Xcode-beta.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVAnimation.h /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVAnimation.h /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVAnimation.h /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-migrator/sdks/AppleTVOS.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVAnimation.h /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-migrator/sdks/AppleTVSimulator.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVAnimation.h /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-migrator/sdks/MacOSX.sdk/System/Library/Frameworks/AVFoundation.framework/Versions/A/Headers/AVAnimation.h /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-migrator/sdks/iPhoneOS.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVAnimation.h /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-migrator/sdks/iPhoneSimulator.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVAnimation.h /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVAnimation.h /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVAnimation.h /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/AVFoundation.framework/Versions/A/Headers/AVAnimation.h /Applications/Xcode.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVAnimation.h /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVAnimation.h /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVAnimation.h /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-migrator/sdks/AppleTVOS.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVAnimation.h /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-migrator/sdks/AppleTVSimulator.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVAnimation.h /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-migrator/sdks/MacOSX.sdk/System/Library/Frameworks/AVFoundation.framework/Versions/A/Headers/AVAnimation.h /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-migrator/sdks/iPhoneOS.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVAnimation.h /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-migrator/sdks/iPhoneSimulator.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVAnimation.h /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 10.0.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/AVFoundation.framework/Headers/AVAnimation.h /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 8.1.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/AVFoundation.framework/Headers/AVAnimation.h /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 8.2.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/AVFoundation.framework/Headers/AVAnimation.h /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 8.3.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/AVFoundation.framework/Headers/AVAnimation.h /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 8.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/AVFoundation.framework/Headers/AVAnimation.h /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 9.0.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/AVFoundation.framework/Headers/AVAnimation.h /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 9.1.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/AVFoundation.framework/Headers/AVAnimation.h /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 9.2.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/AVFoundation.framework/Headers/AVAnimation.h /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 9.3.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/AVFoundation.framework/Headers/AVAnimation.h /Library/Developer/CoreSimulator/Profiles/Runtimes/tvOS 9.0.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/AVFoundation.framework/Headers/AVAnimation.h /Library/Developer/CoreSimulator/Profiles/Runtimes/tvOS 9.1.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/AVFoundation.framework/Headers/AVAnimation.h /Library/Developer/CoreSimulator/Profiles/Runtimes/tvOS 9.2.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/AVFoundation.framework/Headers/AVAnimation.h


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!