Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/* Copyright 2020 APPNEXUS INC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/


#import <UIKit/UIKit.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;

@end

Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/* Copyright 2020 APPNEXUS INC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

#import "AppDelegate.h"
#import <AppNexusSDK/AppNexusSDK.h>

@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{

[[XandrAd sharedInstance] initWithMemberID:1234 preCacheRequestObjects:YES completionHandler:^(BOOL success){
if(success){
NSLog(@"Completion is called with status success ");
}else{
NSLog(@"Completion is called with status failed ");
}
}];
return YES;
}

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES" initialViewController="vXZ-lx-hvc">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment version="4400" identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Banner Ad View Controller-->
<scene sceneID="ufC-wZ-h7g">
<objects>
<viewController id="vXZ-lx-hvc" customClass="BannerAdViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="jyV-Pf-zRb"/>
<viewControllerLayoutGuide type="bottom" id="2fi-mo-0CV"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="kh9-bI-dsS">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
<navigationItem key="navigationItem" id="VXl-Qf-IUU"/>
<connections>
<segue destination="fcC-2W-GMw" kind="push" identifier="openClickThroughURLSegue" id="eLE-kT-97Y"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-20.289855072463769" y="21.428571428571427"/>
</scene>
<!--Simple Web View Controller-->
<scene sceneID="Aed-eF-8RK">
<objects>
<viewController id="fcC-2W-GMw" customClass="SimpleWebViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="b4b-lr-GJt"/>
<viewControllerLayoutGuide type="bottom" id="6AX-Ng-S30"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="JAC-Ci-3Hk">
<rect key="frame" x="0.0" y="0.0" width="375" height="647"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<wkWebView contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Kau-tQ-K5Z">
<rect key="frame" x="0.0" y="0.0" width="375" height="647"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="0.36078431370000003" green="0.38823529410000002" blue="0.4039215686" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<wkWebViewConfiguration key="configuration">
<audiovisualMediaTypes key="mediaTypesRequiringUserActionForPlayback" none="YES"/>
<wkPreferences key="preferences"/>
</wkWebViewConfiguration>
</wkWebView>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="7xD-lD-F4E">
<rect key="frame" x="312" y="28" width="47" height="43"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" heightSizable="YES" flexibleMaxY="YES"/>
<state key="normal" title="X"/>
<connections>
<action selector="btCloseAction:" destination="fcC-2W-GMw" eventType="touchUpInside" id="Sed-16-5u6"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
<navigationItem key="navigationItem" id="R63-lD-2kC"/>
<connections>
<outlet property="webViewOutlet" destination="Kau-tQ-K5Z" id="reG-Et-62K"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="tF9-s8-1D6" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="698.55072463768124" y="2.0089285714285712"/>
</scene>
</scenes>
</document>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/* Copyright 2020 APPNEXUS INC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

#import <UIKit/UIKit.h>

@interface BannerAdViewController : UIViewController

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/* Copyright 2020 APPNEXUS INC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

#import "BannerAdViewController.h"
#import <AppNexusSDK/AppNexusSDK.h>



@interface BannerAdViewController () <ANBannerAdViewDelegate>

@property (nonatomic, readwrite, strong) ANBannerAdView *banner;

@property (nonatomic, readwrite, strong) NSDate *processStart;
@property (nonatomic, readwrite, strong) NSDate *processEnd;
@property (nonatomic, readwrite, strong) NSDate *previousDifference;
@end

@implementation BannerAdViewController

- (void)viewDidLoad
{
[super viewDidLoad];
self.title = @"Banner Ad";

int adWidth = 300;
int adHeight = 250;
NSString *adID = @"17058950";

int adWidth1 = 320;
int adHeight1 = 50;

// We want to center our ad on the screen.
CGRect screenRect = [[UIScreen mainScreen] bounds];
CGFloat originX = (screenRect.size.width / 2) - (adWidth / 2);
CGFloat originY = (screenRect.size.height / 2) - (adHeight / 2);

// Needed for when we create our ad view.
CGRect rect = CGRectMake(originX, originY, adWidth, adHeight);
CGSize size = CGSizeMake(adWidth, adHeight);

// Make a banner ad view.
self.banner = [ANBannerAdView adViewWithFrame:rect placementId:adID adSize:size];

// Needed for when we create our ad view.
CGRect rect1 = CGRectMake(originX, originY, adWidth1, adHeight1);
CGSize size1 = CGSizeMake(adWidth1, adHeight1);

//self.banner = [[ANBannerAdView alloc] initWithFrame:rect1 memberId:memberID inventoryCode:inventoryCode adSize:size1];
self.banner.rootViewController = self;
self.banner.delegate = self;
self.banner.enableLazyLoad = YES;
[self.view addSubview:self.banner];

// Since this example is for testing, we'll turn on PSAs and verbose logging.
self.banner.shouldServePublicServiceAnnouncements = NO;
self.banner.autoRefreshInterval = 10;

// Load an ad.
self.processStart = [NSDate date];
[self.banner loadAd];
}

- (void)adDidReceiveAd:(id)ad {
NSLog(@"Ad did receive ad");
self.processEnd = [NSDate date];
NSTimeInterval executionTime = [self.processEnd timeIntervalSinceDate:self.processStart];
NSLog(@"Updated Ad rendered at: %f", executionTime*1000);
}

-(void) lazyAdDidReceiveAd:(id)ad {
[self.banner loadLazyAd];
}

-(void)ad:(id)ad requestFailedWithError:(NSError *)error{
NSLog(@"Ad request Failed With Error");
self.processEnd = [NSDate date];
NSTimeInterval executionTime = [self.processEnd timeIntervalSinceDate:self.processStart];
NSLog(@"Updated Ad delivery failed at: %f", executionTime*1000);
}

- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

@end
Loading