背景

iOS 第三方 SDK 不支持模拟器,报错提示: building for ios simulator, but the linked framework ‘’xxx(比如: IDLFaceSDK.framework)” was built for ios 解决办法.。

解决办法

首先,在Target -> BuildSettings -> Excluded Source FileNames -> Debug 中添加一行,注意,key选择 Any iOS Simulator SDK,value 中添加报错中提示的 SDK的目录,示例如下:

企业微信20211227-104101.png

然后,在项目中,引用对应 SDK 头文件,以及使用 SDK 方法的地方添加如下代码判断

1
2
3
4
5
6
7
8
9
10
11
12
13
14

#if !(TARGET_IPHONE_SIMULATOR)

#import <xxx/xxx.h>

#endif


#if !(TARGET_IPHONE_SIMULATOR)

[xxx share].yyy = xxx;

#endif