Xcode - Dynamically Adding 3rd party framework

Viewed 166

I have seen a few topics regarding this subject, but as I am not very familiar with xcode and the various ways to include external dependencies, my question is specific to the ZoomSDK.

Zoom provides 2 versions of the SDK, one for simulator and one for device only.

In the integration guide they have you

  • manually add the framework to the "Embeded Binaries" and "Linked Frameworks and Libraries"
  • add the bundle to "Build Phases > Copy Bundle Resources"

In Xcode I do not see separate options for "Embeded Binaries" and "Linked Frameworks". I do have one section for "Frameworks, Libraries, and Embeded Content".

I added the framework here, followed the rest of the install directions and zoom is working appropriately.

I have placed the sdk files in /lib and am able to swap the files for the correct version when building/running the app. (Zoom - Simulator, Zoom - Device Only)

Rather than manually moving the files before building, is there a way to store the files in /lib/zoom-device and /lib/zoom-sim and have xcode choose the appropriate folder when building for device vs sim?

This is a react-native project and eventually i would like to create/add a pod. (currently /lib/ is in .gitignore and any other devs need to download the sdk and create the folder manually)

1 Answers

I managed to create a pre-action under edit scheme->build

case ${ARCHS} in
    *arm*) 
        cp -R ${PROJECT_DIR}/lib/MobileRTC/* ${PROJECT_DIR}/lib
        ;;
    *i386*|*x86_64*) 
        cp -R ${PROJECT_DIR}/lib/MobileRTC-Simulator/* ${PROJECT_DIR}/lib
        ;;
esac

There are probably better ways to do this but it is working.

Related