Getting Started - adform/adform-ios-sdk GitHub Wiki

Getting Started

1. General Info

The use of Adform SDK requires the following:

  • Xcode 16.0 or later.
  • Requires deployment target of 12.0 or later

2. How to import Adform Advertising SDK to your iOS project?

2.1. Using Swift Package Manager

The Swift Package Manager is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.

You can add Adform Advertising SDK as a dependency to your project through Xcode UI or add it to your project's Package.swift file like this:

dependencies: [
    .package(url: "https://github.com/adform/adform-ios-sdk", .upToNextMajor(from: "2.21.0"))
]

Important! Xcode 12 has a bug where static frameworks distributed through SPM sometimes get embedded incorrectly into the app. This issue is mentioned in Xcode 12.4 release notes. If the validation of your archived app fails you may need to use a workaround that strips the embedded frameworks after the build. You can use this build phase script to remove embedded frameworks from the app:

APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"

rm -rf "${APP_PATH}/Frameworks/AdformAdvertising.framework"
rm -rf "${APP_PATH}/Plugins/AdformAdvertising.framework"

2.2. Manually

  • Download the latest build version of Adform Advertising SDK.
  • Drag AdformAdvertising.xcframework to your project.

alt tag

  • When asked select Copy items into destination group's folder.

alt tag

  • Then select AdformAdvertising.xcframework in the project navigator, go to file inspector, and add it to your application's target (Target Membership).

  • Finally import AdformAdvertising and you are ready to use Adform mobile banners:

import AdformAdvertising

2.3. App Tracking Transparency

Apple introduced AppTrackingTransparency framework and tracking permissions in iOS 14. You need to make couple of changes to integrate the SDK.

Ask the user for permission to track app for Advertising purposes using requestTrackingPermissions method. Calling this method will present a systemic permissions alert, therefore it's up to you to decide when it is most appropriate to show it.

if #available(iOS 14.0, *) {
    AdformSDK.requestTrackingPermissions(nil)
}

Add NSUserTrackingUsageDescription entry to your apps Info.plist file.

2.4. App Transport Security

Adform Advertising SDK is fully compatible with Apple security requirements and supports ATS, so no additional changes required for that.

2.5. Query schemes

In iOS 9 you must whitelist any URL schemes that your App wants to query. Our sdk uses "sms" and "tel" URL schemes to determine if device can send sms and make phone calls. Therefore, to avoid possible problems on IOS9 we recommend you to add "sms" and "tel" schemes to the white-list. To do so, developers should add the following to their plist:

    <key>LSApplicationQueriesSchemes</key>  
    <array>  
         <string>sms</string>  
         <string>tel</string>  
    </array>  

2.6. Troubleshooting

  • First of all, try enabling Debug mode to see additional SDK logs in the console. You can find instructions how to do so here.

  • If you get a missing symbols error, it may mean that automatic framework linking has failed, in this case try to add these dependencies explicitly to your project:

    • UIKit.framework;
    • CoreGraphics.framework;
    • QuartzCore.framework;
    • SystemConfiguration.framework;
    • MediaPlayer.framework;
    • AdSupport.framework;
    • CoreTelephony.framework;
    • CoreLocation.framework;
    • CoreMedia.framework;
    • AVFoundation.framework;
    • SafariServices.framework;
    • WebKit.framework;
    • AppTrackingTransparency.framework;
  • If you get a bundle format unrecognized, invalid, or unsuitable error while integrating the SDK, it probably means one of two problems:

    • That you are integrating SDK with Carthage and have added AdformAdvertising.framework to input/output files in Carthage copy-frameworks Build Phase. You should not add this framework to copy-frameworks Build Phase.
    • You have selected Embed in Framework and Libraries project configuration. This configuration should be selected to Do Not Embed.

To start coding check basic AdInline integration guide.

⚠️ **GitHub.com Fallback** ⚠️