title: Solution for iOS SDK Not Supporting Simulator
tags:
- Technology
- iOS
date: 2021-12-27 10:25#
Background#
Third-party iOS SDKs do not support simulators and display an error message: "building for ios simulator, but the linked framework ''xxx (e.g., IDLFaceSDK.framework)" was built for iOS.".
Solution#
First, go to Target -> Build Settings -> Excluded Source FileNames -> Debug and add a line. Note that the key should be selected as Any iOS Simulator SDK, and in the value, add the directory of the SDK mentioned in the error message. Here is an example:
Next, in the project, add the following code to the places where the corresponding SDK header files are referenced and SDK methods are used:
#if !(TARGET_IPHONE_SIMULATOR)
#import <xxx/xxx.h>
#endif
#if !(TARGET_IPHONE_SIMULATOR)
[xxx share].yyy = xxx;
#endif