To link something (even weak), it must be present in the SDK. It doesn't matter if you really use the framework; the linker will fail if instructed to include a link to a file that it cannot find.
You will need to conditionally compile and link your project based on the SDK used. In particular, when setting up the iOS SDK, you want to enable support and a link to CoreAudioKit.framework. When targeting the iOS Simulator SDK, you don’t want to include this support and binding.
To conditionally define the code, you will want to include the header and use the TARGET_OS_SIMULATOR macro (or the deprecated TARGET_IPHONE_SIMULATOR macro for SDKs older than iOS 9.0). This heading is often pulled through others, but it's best to do it yourself.
For example:
#import "MyController.h" #import <TargetConditionals.h> #if !TARGET_IPHONE_SIMULATOR #import <CoreAudioKit/CoreAudioKit.h> #endif @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; #if !TARGET_IPHONE_SIMULATOR // Stuff dependent on CoreAudioKit #endif } @end
Xcode does not support SDK conditional binding in the build phases for targets, so make sure you do not include CoreAudioKit.framework in the build phase of Link Binary With Libraries for your purpose. For link processing, you basically have two options:
- Use automatic link support from clang modules.
- Use SDK Legend Linker Flags
To use auto-binding, you must install Xcode Include Modules (C and Objective-C) and Link Structures .
If you are trying to do something similar with old toolchains or just with tighter control over binding, you can still accomplish this using the SDK conditional Other flag builders . Create conditional SDK entries for this build option to use “-framework CoreAudioKit” (or “-weak_framework CoreAudioKit”) by default and do nothing when setting up the simulator SDK. This screenshot should make it clearer.

If your goal of deploying iOS is older than iOS 8, you should be sure that the framework link is weak because it was added in iOS 8. If you plan to use iOS 8 or later, you can safely use -framework CoreAudioKit.
Jeremy huddleston sequoia
source share