Using Carthage

This article provides information on how to use Carthage to set up Blueshift's iOS SDK.

Using our iOS SDK is easy. Perform the following steps to set it up in your app's Xcode project using Carthage, so that you can integrate our platform with your app using Carthage.

📘

Note

This article provides information on how to set up our SDK in your iOS project using Carthage. If you want to use CocaPods instead, see Set up Blueshift's iOS SDK using CocoaPods.

1. Download Carthage

Carthage is a simple dependency manager that you can use to include our SDK into your Xcode project. Carthage is available as a brew package, and you can run the following command to download and install it on your Mac.

brew install carthage

2. Create a Cartfile

After the installation is complete, create a cartfile in the same directory where your .xcodeproj or .xcworkspace file is located. For example, if your Xcode project is created under code/Blueshift-iOS-SampleApp/Swift, then launch the terminal and change directory (cd) to this location. Once you are into your Xcode project's directory, you can see that the folder contains .xcodeproject or .xcworkspace file in it.

Here, run the following command to create the cartfile.

touch cartfile

In this file, add the following lines to add Blueshift iOS SDK as a dependency in your Xcode project.

  • binary "https://raw.githubusercontent.com/blueshift-labs/Blueshift-iOS-SDK/master/Carthage/blueshift_ios_sdk.json"
    (To add our core SDK as a dependency.)
  • binary "https://raw.githubusercontent.com/blueshift-labs/Blueshift-iOS-SDK/master/Carthage/blueshift_ios_extension_sdk.json"
    (To add our extension for the notification service as a dependency.)

If you want to use a specific version of the SDK, add the dependency to it in the following manner:
binary "https://raw.githubusercontent.com/blueshift-labs/Blueshift-iOS-SDK/master/Carthage/blueshift_ios_sdk.json" == 2.1.6.

After you perform these steps, run the following command on your terminal. Ensure that you are in the same directory on your terminal where the .xcodeproj or .xcworkspace file or both files are located.

carthage update

This step creates a cartfile.resolved file and the Carthage directory in this location.

You can look into the Carthage/Build/iOS folder to verify that Carthage has downloaded our SDK's files.


3. Specify the iOS app's dependency on Blueshift's iOS SDK

Now, launch Xcode and drag-drop these files from the Carthage/Build/iOS folder into Frameworks, Libraries, and Embedded Content section of the General settings of your app's target.

Alt textAlt text

You can skip adding Blueshift_iOS_Extension_SDK.framework file if you don't want to use our rich push notifications capability. Otherwise, ensure that you add both the files.

In the Build Phases settings of your app's target, click + > New Run Script Phase to create a run script.

In the Run Script section, provide the following:

  • Under Shell, enter:
    /usr/local/bin/carthage copy-frameworks
  • Under Input Files, use the + button to add entries similar to these:
    • $(SRCROOT)/Carthage/Build/iOS/BlueShift_iOS_SDK.framework
    • $(SRCROOT)/Carthage/Build/iOS/BlueShift_iOS_Extension_SDK.framework
  • Under Output Files, use the + button to add entries similar to these:
    • $(DERIVED_FILE_DIR)/BlueShift_iOS_SDK.framework
    • $(DERIVED_FILE_DIR)/BlueShift_iOS_Extension_SDK.framework

📘

Note

Use the values above as guides. Ensure that you add entries in the run script based on your app's configuration.

If you plan on using the rich push notifications with images/gifs capability, add a notification service extension. For more information, see Set up notification service extension.

After you add the notification service extension, it's available as a target. In the Build Phases settings of the target, drag-drop the BlueShift_iOS_Extension_SDK.framework file into Link Binary with Libraries section.

Alt textAlt text

If you plan on using the rich push notifications with carousels capability, add a notification content extension. For more information, see Set up notification content extension.

After you add the notification content extension, it's available as a target. In the Build Phases settings of the target, drag-drop the BlueShift_iOS_Extension_SDK.framework file into Link Binary with Libraries section.

Alt textAlt text


4. Register your app with Blueshift

Once you set up the SDK in your Xcode project, register your app as a channel in the Blueshift web app.

Summary

  • The SDK is installed and is ready to configure
  • The Push notification adapters are set for sending push notifications.

That’s it. You can proceed to the next steps.


What’s Next

Now that our SDK is set up, you can get started with it.

Did this page help you?