Releases: Adnuntius/ios_sdk
Fix viewable / visible calculation for Table views thanks to Rainer Grinninger
Rainer Grinninger (rgrinnin) discovered that the viewable / visible events were not working for UI Table Views for their application. Rainer provided a PR to fix the issue and this release is that PR.
Fix random double to int conversion crash when using updateView
A customer reported random crashes when returning to the app from background with the error:
Swift runtime failure: Double value cannot be converted to Int because it is either infinite or NaN
Minor performance improvement for updateView and a few fixes
Once both visible and viewable events have been fired, updateView will bail out early.
The deprecated loadAd function was still generating visible and viewable events which was a mistake.
A few fixes to docs.
Delayed Visible and Viewable Event support
Until this release, the SDK would generate visible and viewable events as soon as the ad was rendered. There was no way to change this, with this release we have added the capability to delay generating these events.
IMPORTANT: By default beginning with SDK 1.10.0 calling loadAd(request, handler)
will result in no visible or viewable events being triggered at all. This is different to the previous default behaviour. You can restore the original behaviour by using a new loadAd variant with delayViewEvents: false
To make viewable / visible events work correctly, each AdnuntiusAdWebView must know whether its visible and how much of the ad is showing before it can generate visible and viewable events. This is facilitated by your client code calling the new updateView(UIScrollView)
function. Initially only support for applications which make use of UIScrollView or UITableView is provided. if you have a case which is not catered for by this new updateView function, you can raise a support issue or raise a PR to add it!
More information on this feature: https://github.com/Adnuntius/ios_sdk/wiki/Visible-and-Viewable-Event-Handling
Deprecations
The following AdnuntiusAdWebView
function has been deprecated:
open func loadAd(_ config: AdRequest, completionHandler: AdLoadCompletionHandler, adnSdkHandler: AdnSdkHandler? = nil) -> Bool
You should migrate your code to use the new loadAd(_ request: AdRequest, _ handler: LoadAdHandler)
The LoadAdHandler
protocol is a merging of the AdLoadCompletionHandler
and AdnSdkHandler
and is quite easy to migrate. All functions in the LoadAdHandler
are optional.
The AdLoadCompletionHandler
onFailure
and onNoAdResponse
are exactly the same in the new protocol.
The AdnSdkHandler
onClose
function is now onLayoutCloseView
.
The onAdResponse
now passes an AdResponseInfo
class instead of the individual width
and height
. The equivalent values from the AdResponseInfo
class are definedWidth
and definedHeight
.
Removals
The following long deprecated AdnuntiusAdWebView
functions have been removed:
open func loadAd(_ config: [String: Any], completionHandler: AdLoadCompletionHandler) -> Bool
open func loadFromConfig(_ config: [String: Any], completionHandler: AdLoadCompletionHandler, adnSdkHandler: AdnSdkHandler? = nil) -> Bool
Extra checks around accessing data from javascript callback
Enable debugging of more of the javascript callbacks
Some changes to the way sizing of ads is derived
Merge pull request #21 from Adnuntius/jp_provide_width_height_more_re… …liably some refactoring and cleanup to get the width and height from defined…
Fix Swift Packages issue
Merge pull request #20 from Adnuntius/release184 release with fix for loading from swift packages
Cleanups
Some cleanups to the javascript scaffolding to bring it closer to how the Android SDK is used, and removed some obselete code.
Added a very simple AdClient http client for testing only.
Fixing Swift breaking change in 1.8.1
Swift supports method overloading so no need for breaking change introduced in 1.8.0. Unfortunately Objective-C does not support method overloading so breaking change for 1.8.0+ still applies.
https://github.com/Adnuntius/ios_sdk/wiki/Upgrading#objective-c-only---method-renamed-and-deprecated
New AdRequest config class
Use class for config rather than a dictionary to make validation and addition of new functionality easier
Deprecated methods removed
- The
loadFromConfig(_ config: [String: Any], completionHandler: AdLoadCompletionHandler) -> Bool
method has been removed. - The
loadFromApi(_ config: [String: Any], completionHandler: AdLoadCompletionHandler) -> Bool
method has been removed.
Objective-C Only - Method renamed and deprecated
The loadAd
method that accepts a [String: Any] dictionary has been renamed to loadFromConfig
The migration is very simple, from a line like this:
bool configResult = [self.adView loadAd:config completionHandler:self adnSdkHandler:nil];
To this:
bool configResult = [self.adView loadFromConfig:config completionHandler:self adnSdkHandler:nil];
New AdRequest config Method
A new loadAd
method that accepts a AdRequest method instead of a [String: Any] array.
To migrate your code you need to migrate your [String: Any] dictionary to an instance of AdRequest object.
See below for a sample migration for both Swift and Objective-C
Swift
The deprecated dictionary format:
let config = [
"userId": globalUserId,
"sessionId": sessionId,
"adUnits": [
[
"auId": "000000000006f450" , "kv": ["version": ["6s", "X"]]
]
],
"useCookies": false
] as [String : Any]
Gets converted to AdRequest:
let adRequest = AdRequest("000000000006f450")
adRequest.sessionId(sessionId)
adRequest.userId(globalUserId)
adRequest.keyValue("version", "6s")
adRequest.keyValue("version", "X")
adRequest.useCookies(false)
Objective-C
The deprecated dictionary format:
NSDictionary* config = @{
@"adUnits" : @[
@{
@"auId":adId, @"auH":@200, @"kv": @{@"version" : @[@"6s", @"X"]}
}
],
@"useCookies": @false,
@"userId": globalUserId,
@"sessionId": sessionId,
@"consentString": @"some consent string"
};
Gets converted to AdRequest:
AdRequest *adRequest = [[AdRequest alloc] init:@"000000000006f450"];
[adRequest height:@"480"];
[adRequest useCookies:true];
[adRequest userId:globalUserId];
[adRequest sessionId:sessionId];
[adRequest consentString:@"some consent string"];
[adRequest keyValue:@"version" :@"6s"];
[adRequest keyValue:@"version" :@"X"];