Carthage Setup

iOS Setup With Carthage

You can also use Carthage for setting up and upgrading the OneSignal SDK.

1 Make sure your current Xcode project is closed.
2 Open Project Directory in Terminal. Run echo 'github "OneSignal/OneSignal-iOS-SDK"' >> Cartfile
3 Run carthage update --no-use-binaries --use-xcframeworks. If you are using Xcode 11 or lower run carthage update --no-use-binaries instead. All references to "OneSignal.xcframework" will be "OneSignal.framework" instead.
4 Open your Xcode project.
5 Go to your application targets’ “General” settings tab, “Embedded Binaries” section.

1512

6 Drag and drop ALL.xcframework files from the <YOUR PROJECT'S DIRECTORY>/Carthage/Build/iOS folder on disk to Frameworks, Libraries, Embedded Content in Xcode Project > App Target > General Tab.

2064 1153

7 Create folder references and click Finish.

731

8 Go to your OneSignalNotificationServiceExtension targets’ “General” settings tab, “Linked Frameworks and Libraries” section.

1769

9 Drag and drop the same OneSignal.xcframework from the <YOUR PROJECT'S DIRECTORY>/Carthage/Build/iOS folder on disk.

ONLY CONTINUE if you are using Xcode 11 or LOWER

10 On your application targets’ “Build Phases” settings tab, click the “+” icon, choose “New Run Script Phase”.

1512

11 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

12 Add the path to the OneSignal framework under “Input Files”:

$(SRCROOT)/Carthage/Build/iOS/OneSignal.framework

1512

👍

Done! Continue onto step 4 of our iOS SDK setup guide.