Getting Started with iOS SDK

iOS SDK Prerequisites

  • Applications using iOS 8.0 or above
  • Applications using Xcode 9.0 or above

Integrate the Smaato iOS SDK

To download the latest version of our iOS SDK, log in to your SPX account, go to the user menu (next to your email address) in the top right corner and select Integration Options. You can also download the SDKs from the Smaato website at https://www.smaato.com/resources/sdks/. For either option, please find the integration documentation below once you have downloaded the SDK. Lastly, by using our SDK you must agree to the terms and conditions.

Option 1: Using Cocoapods

To simplify dependency management, add the following line in your Podfile before executing pod install: pod 'SmaatoSDK'

Option 2: Zipped Package Source

In the unzipped folder, you will find a file called iSoma.framework:

Drag and drop the iSoma.framework file and SMAMoatMobileAppKit.frameworkinto your Xcode application group/project navigator. As shown in this example below.

You will also need to add -ObjC as Other Linker Flags in Build Settings.

Special Instructions for iOS 10

The iOS SDK supports iOS 10 but comes with updated integration steps. Publishers need to update their applications info.plist file with the following settings:

For MRAID – Removal of “Create Calendar Event Entry” and “Save Photo in Photo Library” Functionality

  • The SDK has now removed the MRAID calendar event creation as well as saving a photo to photo library functionality completely.
  • Publishers do not need to add NSCalendarsUsageDescription or NSPhotoLibraryUsageDescription in the project .plist file anymore.

Update ‘Privacy Settings’ in the Info.plist File

  • NSLocationWhenInUseUsageDescription
  • This key is required only if the publisher wants the SDK to monitor the user’s location:
[iSoma setGPSEnabled:YES];

App Transport Security

MRAID 2.0 Limitations

Smaato does not support the following in  iOS SDK:

    • createCalendarEvent()
    • storePicture()
    • "Two-part" ads

Update ATS Settings in the Info.plist File

Make sure to set the following key file in the Info.plist of your app: NSAllowsArbitraryLoads: Yes

To use the Smaato SDK, please don’t add the following keys to your .plist file:

  • NSAllowsArbitraryLoadsForMedia
  • NSAllowsArbitraryLoadsInWebContent
  • NSAllowsLocalNetworking

In iOS 10 and later, and macOS 10.12 and above, the value of the key NSAllowsArbitraryLoads is ignored. This results in an effective value for this key of its default value of NO if any of the following keys are present in your app’s Info.plist file.

Changes for the GPS location handling

Apple recently enforced the policy related to the guidelines which may result in an app rejection. The following reason is usually provided: Your app’s code references one or more APIs that access sensitive user data. The app’s Info.plist file should contain a NSLocationWhenInUseUsageDescription key with a user-facing purpose string explaining clearly and completely why your app needs the data. Starting from this version of the iOS SDK, we changed the way how the GPS location is handled in the SDK. If your app is not collecting the location data, you don’t need to do anything as long as you are using the latest SDK.

In case if your app is gathering location data and feeding it to the SDK. In order to send more targeted ads using the location data from the user, you need to request authorization to use location services inside your app, following Apple’s configurations guidelines, depending on the authorization level that you choose:

For When-In-UseAuthorization Please refer to this link.
For Always-Authorization: PleasePlease refer to this link

Also to enable monitoring GPS data on Smaato SDK side by calling:

[iSoma setGPSEnabled:YES];

Configure User Properties

You can configure the user profile to individual ads or to global by updatingadView.adSettings.userProfile or [iSoma userProfile]with the respective properties.

The properties and possible values are shown here:

Property name Possible values Description
age Integer value Age of the user
gender

SOMAUserGenderFemale

SOMAUserGenderMale

Gender of the user
region String Region of the user
zip String Zip code of the user
  • yearlyIncome
  • ethnicity,
  • education,
  • interestedIn,
  • maritalStatus,
  • country,
  • countrycode,
  • city

Integrating Swift

From version 8.0 onward, the Smaato iOS SDK comes with a built-in Swift module structure.

Simply drag and drop the framework to the Swift project and you are ready to start. Bridging headers will not be required.

Using the Smaato Demo App

Within the SDK ZIP file, there’s a demo app that shows an example of how to integrate our SDK, how to use it and how to implement desired options.

The demo app allows you to:

    • Use your Publisher and Adspace ID.
    • Request multiple adspaces (text, image, rich media, medium rectangle, video)
    • Configure refresh time
    • See how a banner, can be used across multiple screens
    • Use a classic BannerView
    • Use a full-screen banner
    • Use an interstitial banner
    • Use a toaster banner
    • See how to implement banners directly from your XML layout

Modified: June 26, 2019 at 10:48 am