I have external closed library that can compile with armv7s (etc) only. when I try to compile against simulator obviously its not running and display some errors. I don't want to insert this library to my code unless I can configure Xcode to use this library only when i test with a device. unfortunately, i tried to do it with cocoapods with no success and i wonder if there any way to do it?
An XCFramework can be either static or dynamic and can include headers.
Static frameworks contain a static library packaged with its resources. Dynamic frameworks contain the static/dynamic library with its resources. In addition to that, dynamic frameworks may conveniently include different versions of the same dynamic library in the same framework.
Dynamic library - a unit of code and/or assets linked at runtime that may change. However, only Apple is allowed to create dynamic libraries for iOS . You're not allowed to create these, as this will get your app rejected.
Yes, this can be done. I had a similar problem with a framework that caused linker errors only in the simulator so I setup up my project to only use the framework when building for a device.
The following assumes you are not using cocoa pods to link the library. I'm not sure what would need to be changed if you are.
Now do a debug build.
The above change basically means that the library is linked in for all builds except for iOS Simulator builds.
You will probably also need to make some code changes. Any code making any reference to header files or other symbols from the library should be wrapped as follows:
#if !TARGET_IPHONE_SIMULATOR
#import "someLibrary.h"
#endif
#if !TARGET_IPHONE_SIMULATOR
// Use stuff from the library
#endif
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With