Open-Measurement-SDKiOS

Build Status

Overview

This repository contains the native iOS code of Open Measurement SDK, also known as OM SDK.

Folder Structure

Files are organized as a standard iOS project for Xcode and Cocoapods.

AppVerificationLibrary.xcworkspace

The Xcode workspace which includes both AppVerificationLibrary.xcodeproj and Pods/Pods.xcodeproj.

AppVerificationLibrary/

Contains the source code for the SDK.

OMSDK/

Contains the header and info.plist for the dynamic framework.

AppVerificationLibrary-Tests/

Contains the source code for the unit tests.

OM-TestApp/

Contains the source code for the iOS Reference App.

OM-Demo/

Contains the demo project template, OM-Demo-Template.xcodeproj and other files which ship with OM SDK.

Note: OM-Demo is intended for integrators to build and run after being copied into a distribution archive rather than for SDK engineers debugging the SDK and/or Reference app. SDK engineers should run OM-TestApp in the AppVerificationLibrary.xcworkspace.

OM-FullstackAppTests/

Contains the fullstack tests that begin with iOS app setup and are validated based on the events received by an OMID verification client.

Note: In order for these tests to run properly, the following JS OMID artifacts need to be copied into the OM-FullstackApp/Assets/OMIDJS/ directory: (1) omsdk-v1.js (2) omid-session-client-v1.js (3) omid-verification-client-v1.js (4) omid-validation-verification-script-v1.js

Config.xcconfig and ConfigTest.xcconfig

Textual configuration files that supplement the settings in the .xcodeproj file, including semantic version number and partner namespace.

Podfile and Podfile.lock

Cocoapods configuration files.

docs/

Implementation instructions

CHANGELOG.md

All notable changes to the project are documented in the changelog. The format is based on Keep a Changelog.

Integration Instructions

Please see the detailed instructions in the docs directory.

Note: The remaining instructions in this file are for developers making changes to the OM SDK library. Developers who want to integrate OM SDK into their apps should download the namespaced builds from the IAB Tech Lab portal.

Developer Setup

The OM SDK library is built as an Xcode project. The library does not have any external dependencies, but the tests make use of OCMock, which is installed via Cocoapods.

Prerequisites

  • Xcode 11.3 or later
  • Cocoapods 1.8.4 or later — Follow the installation instructions at the Cocoapods website.

Prepare workspace with Cocoapods

In order to run unit tests, you need to install dependencies via Cocoapods. Open a shell in your local working directory and enter:

pod install

Download the OM SDK Service JavaScript

In order to run the test app, you need to:

  • Download the latest omsdk-v1.js release from the IAB portal
  • Copy it into OM-Demo/OMSDK/Service/.

Building with Xcode

Build the SDK and run tests using Xcode.

Open AppVerificationLibrary.xcworkspace

  • The AppVerificationLibrary target builds the library.
  • The OMSDK target builds the dynamic framework.
  • The AppVerificationLibrary-Tests target performs the unit tests.
  • The OM-TestApp target builds both the reference app and the library dependency.

Building with Command Line

Build SDK as a Static Library

xcodebuild build \
  -workspace AppVerificationLibrary.xcworkspace \
  -scheme AppVerificationLibrary

Build SDK as a Dynamic Framework

xcodebuild build \
  -workspace AppVerificationLibrary.xcworkspace \
  -scheme OMSDK

Run SDK tests

xcodebuild test \
  -workspace AppVerificationLibrary.xcworkspace \
  -scheme AppVerificationLibrary \
  -destination 'platform=iOS Simulator,name=iPhone 11,OS=14.2'

Build Reference App

xcodebuild build \
  -workspace AppVerificationLibrary.xcworkspace -scheme OM-TestApp \
  -configuration Debug \
  -destination 'platform=iOS Simulator,name=iPhone 11,OS=14.2' \
  SYMROOT=build

Run Reference App in Simulator

open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app
 # ... wait until simulator is launched ...
xcrun simctl install booted ./build/Debug-iphonesimulator/OM-TestApp.app
xcrun simctl launch booted com.iabtechlab.OM-TestApp

Generating Documentation

The documention for the public OMID API is generated with the tool Jazzy.

jazzy --objc --author IAB \
  --sdk iphonesimulator \
  --umbrella-header AppVerificationLibrary/OMIDImports.h \
  --framework-root AppVerificationLibrary \
  --module OMSDK \
  --module-version 1.4 \
  --undocumented-text '' \
  --output jazzy