Last Updated

April 2017

  • Audio/Video ads no longer stop other media apps (ex. Spotify) if no audio is played.
  • When audio is played the other apps are paused. When media finishes the other audio apps are signaled to let them resume their media. (Tested with Spotify and Apple Music)
  • Fix issue where playing a StreamView ad while deallocating the AdSpace could lead to a crash.
  • Fix extremely rare crash where RPC communication between ad and native SDK was interrupted by a deallocation.

March 2017

  • Fix dangling pointer crash related to deallocation of WSAdSpace (reported by publisher)
  • Fix permission exception crash for when permission descriptions are missing from info.plist

November 2016

  • Fix bug where opening the landing page from an interstitial ad puts the landing page behind the ad.
  • Fix over release issue for WSURLConnectionOperation.
  • Add support for bitcode. While this increases the size of the SDK download, it will not significantly increase the size of your app. The app will be sliced on Apple’s servers into specific architecture builds and make the final app download the same size or smaller. To enable bitcode for your app, go to Project>Build Settings>Build Options, set Enable Bitcode to Yes.

 

Add the Widespace SDK

iOS SDK version 4.8.5 download

 

Deliverables

AppleDoc Folder

Contains the updated AppleDoc of the SDK where you’ll be able to find more specific information about the methods and events available.

WSLibrary Framework

WSLibrary framework includes all the SDK logic. Through the framework you will also able to access the WSAdSpace.h file including the public delegates and methods that you as a publisher are able to access in order to adapt the SDK integration after your specific environment and needs.

 

CocoaPods Integration

CocoaPods Integration

 

What is CocoaPods?

CocoaPods is a package manager with dependency linking designed for use when developing Objective-C (soon also Swift) applications. CocoaPods works by adding a “podfile” to the project folder where deployment platform and current dependencies are defined. CocoaPods will resolve all dependencies for you and keep your code separated from the dependencies in a nice clean way.

Learn more at CocoaPods.org

 

How to install CocoaPods

Installing CocoaPods is as easy as running this command in your terminal:

$ sudo gem install cocoapods

 

Add Widespace PodSpec

Create Podfile & install

Create a file called “Podfile” (no extension needed) in your project directory containing this:

  
 
source 'https://bitbucket.org/WidespaceGIT/widespacepublicpodrepo.git'
platform :ios, '6.0'

target 'TARGET_NAME' do
    pod 'WidespaceSDK'
end

Once the file is created, open a terminal in your project folder and run:

 
    
$ pod install
 

When running $ pod install it will automatically generate a new xCode workspace that you will use instead:

PROJECT_NAME.xcworkspace

 

In your info.plist

Add the following entries to your Info.plist (SupportingFiles/Info.plist).

Note that from iOS 10 you need to include all permissions used in your ‘info.plist’:

   
<key>NSLocationWhenInUseUsageDescription</key>
<string>This message will be shown for the user when requesting for their location and can be modified</string>

<key>NSCalendarsUsageDescription</key>
<string>This message will be shown for the user when requesting for their location and can be modified</string>

<key>NSPhotoLibraryUsageDescription</key>
<string>This message will be shown for the user when requesting for their location and can be modified</string>

<key>NSMicrophoneUsageDescription</key>
<string>This message will be shown for the user when requesting for their location and can be modified</string>

<key>NSCameraUsageDescription</key>
<string>This message will be shown for the user when requesting for their location and can be modified</string>

 

Needed in order for the app to allow http request and all creatives to work properly:

  
    
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>

 

In MyViewController.h

In any ViewController that you want to display ads, you need to import the WSAdSpace.h header and implement the WSAdSpaceDelegate protocol.

include the following code:

// MyViewController.h
#import <WSLibrary/WSAdSpace.h>

@interface MyViewController : UIViewController <WSAdSpaceDelegate> {

WSAdSpace *myAdSpace;

}

The <WSAdSpaceDelegate> lets your ViewController access its delegate methods.

 

In MyViewController.m

One common way to implement an ad display can look like this:

    // MyViewController.m
    - (void)viewDidLoad
    {
        // Declare and Initiate the WSAdSpace object
        myAdSpace = [[WSAdSpace alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 0)
                                                 sid:@"64c174ed-9ca1-4390-b456-8bbcd2c89757"
                                                 autoStart:YES
                                                 autoUpdate:NO
                                                 delegate:self];
        
        // Add WSAdSpace as a subview of MyViewController
        [self.view addSubview:myAdSpace];
    }

Note: “self.view.frame.size” might have to be modified dependent on what view frame you want to pick the size from.

Manual SDK Integration

Manual SDK Integration

 

Add SDK Manually

The options screen.

Start by downloading the SDK-zip file and unarchive it. The contents of the ZIP-file is the SDK. Add the the files to your project by dragging them to the ‘Frameworks’-folder found in the ‘Project navigator’ of your XCode project. Make sure the ‘Copy items into destination..’-option is highlighted as well as the ‘Add to targets’-option for the targets that you want to be able to show Widespace ads.

The Widespace SDK is now added to your project! The next step is to add the frameworks that is required by the SDK.

 

Link required Frameworks

  • AdSupport.framework
  • AVFoundation.framework
  • AssetsLibrary.framework
  • CoreGraphics.framework
  • CoreLocation.framework
  • CoreMedia.framework
  • CoreMotion.framework
  • CoreTelephony.framework
  • CoreVideo.framework
  • EventKit.framework
  • EventKitUI.framework
  • Foundation.framework
  • QuartzCore.framework
  • SafariServices.framework
  • SystemConfiguration.framework
  • UIKit.framework
  • WebKit.framework

 

The Add Frameworks screen.

To add frameworks in XCode, select the summary tab for the target you want to have access to Widespace ads. Scroll down to the ‘Linked Frameworks and Libraries’-section and select the ‘+’-button. This brings up a dialog that lets you choose frameworks and link them to your target. Use the search field to find the frameworks.

 

In your info.plist

Add the following entries to your Info.plist (SupportingFiles/Info.plist).

Note that from iOS 10 you need to include all permissions used in your ‘info.plist’:

   
<key>NSLocationWhenInUseUsageDescription</key>
<string>This message will be shown for the user when requesting for their location and can be modified</string>

<key>NSCalendarsUsageDescription</key>
<string>This message will be shown for the user when requesting for their location and can be modified</string>

<key>NSPhotoLibraryUsageDescription</key>
<string>This message will be shown for the user when requesting for their location and can be modified</string>

<key>NSMicrophoneUsageDescription</key>
<string>This message will be shown for the user when requesting for their location and can be modified</string>

<key>NSCameraUsageDescription</key>
<string>This message will be shown for the user when requesting for their location and can be modified</string>

 

Needed in order for the app to allow http request and all creatives to work properly:

  
    
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>

 

In MyViewController.h

In any ViewController that you want to display ads, you need to import the WSAdSpace.h header and implement the WSAdSpaceDelegate protocol.

include the following code:

 // MyViewController.h
#import <WSLibrary/WSAdSpace.h>

@interface MyViewController : UIViewController <WSAdSpaceDelegate> {

WSAdSpace *myAdSpace;

}

The <WSAdSpaceDelegate> lets your ViewController access its delegate methods.

 

In MyViewController.m

One common way to implement an ad display can look like this:

    // MyViewController.m
    - (void)viewDidLoad
    {
        // Declare and Initiate the WSAdSpace object
        myAdSpace = [[WSAdSpace alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 0)
                                                 sid:@"64c174ed-9ca1-4390-b456-8bbcd2c89757"
                                                 autoStart:YES
                                                 autoUpdate:NO
                                                 delegate:self];
        
        // Add WSAdSpace as a subview of MyViewController
        [self.view addSubview:myAdSpace];
    }

Note: “self.view.frame.size” might have to be modified dependent on what view frame you want to pick the size from.

 

 

Do you have any questions or need further guidance?

Feel free to contact integrations@widespace.com and we’ll do our very best to help you out!

Was this article helpful to you?