iOS SDK Installation
Pre-requisites
- Xcode version 15.1 or newer
- Obtain client settings from Publift:
TENANT_CODE
TAG_ID
GADApplicationIdentifier
Installation (Swift Package Manager)
- Open your Xcode project
- In Xcode, select the menu item “File > Add Package Dependencies…”
- On the “Add Packages” popup, enter the package URL “https://github.com/Publift/fuseapp-swift-package.git"
- Select “fuseapp-swift-package” and click the “Add Package” button
- On the “Choose Package Products” popup, select your app in the “Add To Target” column and tap the “Add Package” button
- In the main Xcode window left panel,
FuseAppSDK
will now be listed under “Package Dependencies”
Note: If the Xcode “Issue Navigator” tab displays a build message “multiple potential binary artifacts found” for “DTBiOSSDK” or “FBAudienceNetwork”, these messages can be safely ignored.
Installation (CocoaPods)
- Install CocoaPods in your Xcode project
- Add the following lines to your
Podfile
:
# Put these lines at the top of your Podfile.
platform :ios, '15.0'
source 'https://dl.cloudsmith.io/BrnMk9bbufLlX4Vd/publift/fuseapp/cocoapods/index.git'
source 'https://cdn.cocoapods.org/'
# Add the 'FuseAppSDK' package to your app.
target 'MyApp' do
use_frameworks!
pod 'FuseAppSDK'
end
# Put these lines at the bottom of your Podfile.
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
end
end
end
For the platform
configuration line, we require iOS 15.0 or newer.
- Run
pod install
(orpod install --repo-update
if it fails)
Build Settings
In your Xcode project “Build Settings”, set the following configuration:
Key | Value |
---|---|
User Script Sandboxing | No |
App Info.plist Settings
Add the following key/value pairs in the Info.plist
file of your Xcode project:
Key | Value |
---|---|
com.publift.mobile.TENANT_CODE | (Provided by Publift) |
com.publift.mobile.TAG_ID | (Provided by Publift) |
GADApplicationIdentifier | (Provided by Publift) |
SKAdNetworkItems | Copy & add the contents from here. |
GoogleUtilitiesAppDelegateProxyEnabled | NO |
App Uses Non-Exempt Encryption | NO |
Initialization
Add the following code to your UIApplicationDelegate
:
import FuseAppSDK
...
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
...
FuseSDK.shared.initializeSDK()
return true
}
If your app is using a SwiftUI App
struct, you can add a UIApplicationDelegateAdaptor
to initialize the Fuse SDK:
import FuseAppSDK
@main
struct MyApp: App {
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
...
}
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
FuseSDK.shared.initializeSDK()
return true
}
}