Upgrading Vungle iOS SDK to 3.2.0

We always recommend using our latest SDKs - they're more stable, more efficient, and allow you to take advantage of the latest and greatest ad formats (which often improves overall revenue generation). With our latest SDK there are a couple project changes that need to be made in order to get everything running properly:

 

  1. WebKit.framework needs to be added as an optional dependency
    • This can be done quickly by selecting opening your project in Xcode, selecting your app target in Project Settings, and adding an additional Framework in the General Tab.  It can be added as Optional.
  2. The linker flag -ObjC is now required
    • This can be added by navigating to Build Settings and adding -ObjC to Other Linker Flags in the Linking section

 

With these two changes in place you should be good to go!

 

If the WebKit.framework is missing you might run into compilation errors similar to the following :


Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_WKWebView", referenced from:
      l_OBJC_$_CATEGORY_WKWebView_$_VungleWKWebView in VungleSDK(WKWebView+VungleWKWebView.o)
ld: symbol(s) not found for architecture x86_64

Without the -ObjC linker flag added you might run into runtime exceptions similar to the following:


2015-09-10 10:18:22.895 Vungle Sample App[20636:14463247] -[UIWebView setDelegateViews:]: unrecognized selector sent to instance 0x7f9548e59b10
2015-09-10 10:18:22.898 Vungle Sample App[20636:14463247] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIWebView setDelegateViews:]: unrecognized selector sent to instance 0x7f9548e59b10'
*** First throw call stack:

Updating from an SDK version older than 3.1.2?

If you are updating from a version prior to 3.1.2 also make sure that you make the following changes, otherwise the above steps should be all the changes you need!

There are a couple API changes that have been made to better reflect ad availability in the latest Vungle iOS SDK release, but the code churn is small and can be completed quickly.

 

isCachedAdAvailable has been renamed to isAdPlayable 

This was done to reflect some of the additional restrictions on ad playability that include more than knowing a cached ad is in place, particularly around Daily View Limits and view / time thresholds.  The code change for this is simple - just replace any existing calls to the Vungle SDK singleton's isCachedAdAvailable method with the new isAdPlayable method.  Here's an example:

Old


if ([[VungleSDK sharedSDK] isCachedAdAvailable]) {

    //Do some awesome stuff here!

}

 

New


if ([[VungleSDK sharedSDK] isAdPlayable]) {

    //Do some awesome stuff here

}

 

vungleSDKhasCachedAdAvailable has been replaced with vungleSDKAdPlayableChanged:(BOOL)isAdPlayable

This same change is also reflected in the Vungle SDK's delegate method, previously vungleSDKhasCachedAdAvailable, and now vungleSDKAdPlayableChanged:(BOOL)isAdPlayable . In addition to this renaming, the Vungle iOS SDK now also passes a parameter to denote playability - this way, with a single delegate method, you can now also be notified when playability has been lost and update your UI or app logic accordingly!  Here's how the change might look:

 

Old


- (void)vungleSDKhasCachedAdAvailable {
    NSLog(@"A new cached ad has been downloaded");
    //Update UI / GameLogic
}

New


- (void)vungleSDKAdPlayableChanged:(BOOL)isAdPlayable {
	if (isAdPlayable) {
		NSLog(@"An ad is available for playback");
                //Enable Ad-Driven UI / GameLogic
	} else {
		NSLog(@"No ads currently available for playback");
                //Disable Ad-Driven UI / GameLogic
	}
}
Have more questions? Submit a request

Comments

  • Avatar
    instagramlikes

    Thanks for information
    Corepillar
    Calcsolutions
    Loraweb
    AVIVALA
    Varkon

  • Avatar
    Trương Hữu Lộc

    I added the -ObjC but still get the same crash. any idea?