# Bundle Pixel harness for iOS A real iOS app with a real WKWebView. It runs the six ad setups from the test bench's Real apps tab: | Setup | How the ad is loaded | What the tag should report | |---|---|---| | Plain WebView | `load(URLRequest)` | no bundle (iOS has no header fallback) | | Bundle in ad URL | `load(URLRequest)` with `?bundle=` | the app's bundle id, from the URL | | MRAID 3 with MRAID_ENV | ad HTML wrapped with MRAID_ENV and mraid.js | the bundle id, from MRAID_ENV | | MRAID 3 getEnvironment | ad HTML wrapped with mraid.js | the bundle id, from getEnvironment() | | MRAID 2 with macro | `%%APP_BUNDLE%%` replaced in the ad HTML | the bundle id, from the macro | | Cross-origin iframe | sandboxed iframe in the page | no bundle | ## Build 1. In Xcode, choose File, New, Project, iOS App. Use Swift and UIKit with a storyboard. 2. Set the bundle identifier to `cc.cleartrust.bundlepixel.harness`. Any identifier works; the test bench compares against whatever the app reports. 3. Replace the project's `ViewController.swift` with the one in this folder. 4. To test against a test bench on your Mac over http, add `NSAppTransportSecurity` with `NSAllowsArbitraryLoads` set to YES in Info.plist. The hosted test bench is https and needs nothing. 5. Run on a simulator or an iPhone, check the server field, and tap **Run all**. Results show in the app at the end and in the test bench's Real apps tab. Safari's Web Inspector can attach to the WebView on iOS 16.4 and later.