更新时间:2023-10-16 15:09:04
我知道这是一个老问题,但如果有人仍在寻找答案,可以使用弱链接来指定某些库可选。
I know this is an old question, but if someone's still looking for the answer, you can use Weak Linking to specify that certain libraries are optional.
然后,在通常使用特征的代码中,您可以检测到您在模拟器中在编译时与
Then, in the code that would normally use the features, you can detect that you're in the simulator at compile time with
#if TARGET_IPHONE_SIMULATOR
NSLog(@"I'm in the simulator");
#endif
或在运行时检查
or at run time by inspecting the value of
[[UIDevice currentDevice] model]
并以编程方式避免使用模拟器环境中不存在的库。
and programmatically avoid using the libraries that don't exist in the simulator environment.