Skip to content

SDK integration using Carthage

Vilas Dilip Mane edited this page Mar 18, 2021 · 2 revisions
  1. Create a Cartfile in the same directory where your .xcodeproj or .xcworkspace is, Run the following command to create the Cartfile:

      touch Cartfile
    
  2. Open the Cartfile in Xcode, Run the following command to open the Cartfile:

      open -a Xcode Cartfile
    
  3. Add the following framework into Cartfile:

     github "https://github.com/SourcePointUSA/ios-cmp-app.git" == 5.3.5
    
  4. Close your Cartfile in Xcode and head back to Terminal. Run the following command for below Xcode 12:

      carthage update --platform iOS
    

    As Carthage doesn't work out of the box with Xcode 12, this document will guide through a workaround that works for most cases.

    Run the following command for Xcode 12+

     carthage.sh update --platform iOS
    
  5. Adding Frameworks to Your Project:

    Back in Xcode, go to Project Navigator. Select the target, choose the General tab at the top, and scroll down to Linked Frameworks and Libraries section at the bottom. In the Carthage Finder window, navigate into Carthage/Build/iOS. Drag ConsentViewController.framework into the Linked Frameworks and Libraries section in Xcode.

  6. On your application target Build Phases settings tab, click the + icon and choose New Run Script Phase. Create a Run Script in which you specify your shell (ex: /bin/sh), add the following contents to the script area below the shell: 

    /usr/local/bin/carthage copy-frameworks 



  7. Add the paths to the frameworks under “Input Files":


     $(SRCROOT)/Carthage/Build/iOS/ConsentViewController.framework
    
  8. Add the paths to the copied frameworks to the “Output Files”:


    $(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/ConsentViewController.framework

    

Troubleshooting

  1. With Xcode 12+, if you face below error while running application on simulator then,

    Building for iOS Simulator, but the linked and embedded framework 'ConsentViewController.framework' was built for iOS + iOS Simulator

    navigate to Build Settings of your project -> Build Options -> Validate Workspace -> Set to Yes.

    Validate Workspace