You are on page 1of 23

Partner Documentation

The Velti mGage Ad Server

iPhone Software Development Kit


(SDK)
User Guide

Ad Server Version 3.6


Release Date: April, 2010
Velti iPhone SDK

Release Release Author Auditor Audit Audit


Version
Status Date Name Role Name Role Date Comments
Senior
Darrell
1.0.0 Final 08/15/2009 Software
Gillmeister
Engineer
Senior
Darrell
1.1.0 Final 12/11/2009 Software
Gillmeister
Engineer
Senior
Darrell
1.2.0 Final 01/29/2010 Software
Gillmeister
Engineer
Senior
Darrell
1.3.0 Final 03/15/2010 Software
Gillmeister
Engineer
Senior
Darrell
1.4.0 Final 04/16/2010 Software
Gillmeister
Engineer

Proprietary Notice

This material is proprietary to Velti S.A. It contains trade secrets and


confidential information which is solely the property of Velti. This
material shall not be used, reproduced, copied, disclosed, and
transmitted, in whole or in part, without the express consent of Velti.

© 2010 Velti S.A. All Rights Reserved

© 2010 Velti S.A. Page 2/23


Velti iPhone SDK

Table of Contents

1 Introduction ................................................................................................... 5
1.1 Purpose.................................................................................................... 5
1.2 Audience .................................................................................................. 5
1.3 Prerequisites ............................................................................................. 5

2 SDK Contents.................................................................................................. 6

3 Installing the SDK .......................................................................................... 7


3.1 Add the SDK Contents ............................................................................... 7
3.2 Configure Build Targets .............................................................................. 8
3.3 Add the Dependent iPhone SDK Libraries ..................................................... 8

4 Application Delegate Integration ................................................................... 9


4.1 Adopt the VeltiManagerDelegate Protocol..................................................... 9
4.2 Add Initialization to The Application Delegate Class ....................................... 9

5 Advertisements ............................................................................................ 10
5.1 Initialization .............................................................................................10
5.2 Adopt the VeltiViewDelegate Protocol .........................................................10
5.3 Insert a VeltiView Object ...........................................................................11
5.3.1 Programmatically Add a Custom Sized VeltiView .............................................. 11
5.3.2 Programmatically Add an Interstitial VeltiView ................................................. 11
5.3.3 Add a VeltiView Using Interface Builder ........................................................... 12

6 Click-to-Action .............................................................................................. 13
6.1 Initialization .............................................................................................13
6.2 Custom Application URL ............................................................................13
6.3 CFBundleVersion ......................................................................................13
6.4 CFBundleIdentifier ....................................................................................14

7 Statistics ....................................................................................................... 15
7.1 Initialization .............................................................................................15
7.2 Event Logging ..........................................................................................15
7.2.1 Standard Event Tracking ............................................................................... 15
7.2.2 Event Duration Tracking ................................................................................ 16
7.2.3 Supplementary Event Properties .................................................................... 17
7.3 Application Session Tracking......................................................................17
7.4 Location Tracking .....................................................................................17
7.4.1 Managed Location ......................................................................................... 18
7.4.2 Application Provided Location ......................................................................... 18
7.5 CFBundleIdentifier ....................................................................................18

© 2010 Velti S.A. Page 3/23


Velti iPhone SDK
7.6 CFBundleShortVersionString......................................................................18

8 Additional Features ...................................................................................... 19


8.1 Activity Indicators.....................................................................................19
8.2 Animations ..............................................................................................19
8.3 Local Landing Page ...................................................................................19
8.4 Application Exit Confirmation .....................................................................20
8.5 Image Creative Auto Sizing .......................................................................21
8.6 Language ................................................................................................21
8.7 Test Mode................................................................................................21

9 Frequently Asked Questions......................................................................... 22


9.1 What is the Velti iPhone SDK compatibility with iPhone SDK versions? ...........22
9.2 How do I know what version of the Velti iPhone SDK I'm using?....................22
9.3 Do Image Creatives Automatically Resize? ..................................................22

10 Class Reference ............................................................................................ 23

© 2010 Velti S.A. Page 4/23


Velti iPhone SDK

1 Introduction

1.1 Purpose

This document describes how to integrate and utilize the application programming
interface for displaying ads, tracking application statistics, and tracking click to
action within an iPhone application using the Velti iPhone SDK. The API uses
Objective C and the iPhone SDK.

Note that this document is best viewed in Adobe Reader in order


to maintain links to external resources.

1.2 Audience

This document is intended for iPhone application developers familiar with the
iPhone SDK and Xcode developer tools as well as the Objective C programming
language.

This document is intended to aid actual and prospective developers in scoping and
planning integration via the Velti iPhone SDK. It is not intended to enable
developers to execute integration without further information and support from
Velti. Please contact Velti to arrange for API integration support.

Concrete programming examples and screenshots are provided throughout this


document.

1.3 Prerequisites

Before integrating the Velti iPhone SDK, the partner needs to:

 Be provisioned within the Velti service platform.


 Establish partner and content identifiers.

Please contact Velti to start the partner provisioning process.

© 2010 Velti S.A. Page 5/23


Velti iPhone SDK

2 SDK Contents

The contents of the SDK are presented in the following table:

Resource Name Description


VeltiView.h The container that displays an advertisement.
VeltiManager.h The class used to enable Velti iPhone SDK features
and specify their properties.
libVeltiSDK.a The non-debug static library deployed on the device or
in the simulator.
libVeltiSDKDebug.a The debug static library deployed on the device or in
the simulator.
VeltiSDKResource.bundle The bundle that contains critical resources used by all
static libraries listed above. This bundle must
accompany all deployments of your application
including the final distribution.

Note that the debug static library is built with debug output enabled and is included to
help assist with debugging activities should that be required. However, it is strongly
advised to use the non-debug static library for your final application distribution as it
has been optimized for performance.

Note that the static libraries are multi-architectural binaries built using the lipo utility
and thus are capable of running on device architectures as well as through the
simulator.

© 2010 Velti S.A. Page 6/23


Velti iPhone SDK

3 Installing the SDK

The SDK integrates with your application using the Xcode IDE. The following
sections provide step by step instructions which detail the SDK installation process.

3.1 Add the SDK Contents

1. Locate the VeltiSDK <version>.zip file and unzip the contents.


2. Locate the unzipped VeltiSDK folder and drag the folder to the top level of
your application as shown in the following screenshot:

3. You will be prompted upon adding the SDK contents to your application with
the following window:

Note the following:


 If you have previously copied the SDK contents into you application, you will
need to first delete the folder from your application directory before proceeding
with copying the contents otherwise the copying operation will fail.
 'Copy items into destination group's folder (if needed)' will copy the contents
into your application's directory. Select this option if you are not sharing the
SDK between several applications. If you are sharing the SDK between several
applications, then it is advised to use a reference to a common location where
the SDK can be accessed by all applications. This approach centralizes the
resources which can be updated in one location when new versions of the SDK
are released.
 Ensure that in the 'Add to Targets' section that no targets have been selected.
This will be added in a separate step below.

© 2010 Velti S.A. Page 7/23


Velti iPhone SDK

The expanded VeltiSDK folder in your application will appear as follows:

3.2 Configure Build Targets

Note the Application targets identified by the icon under the Targets section in
your Xcode project.

All Application targets must have the following:

 VeltiSDKResource.bundle added to 'Copy Bundle Resources'


 The appropriate static library added to 'Link Binary With Libraries'

3.3 Add the Dependent iPhone SDK Libraries

The SDK is dependent upon the following iPhone SDK libraries:

Linked Library Type

QuartzCore.framework Required

MediaPlayer.framework Required

UIKit.framework Required

Foundation.framework Required

CoreGraphics.framework Required

MessageUI.framework Weak

SystemConfiguration.framework Required

CoreLocation.framework Required

libsqlite3.dylib Required

© 2010 Velti S.A. Page 8/23


Velti iPhone SDK

4 Application Delegate Integration

The following sections provide discussion and code snippets that demonstrate
application delegate integration that is required for all Velti iPhone SDK features.

4.1 Adopt the VeltiManagerDelegate Protocol

Edit the application delegate header file to adopt the VeltiManagerDelegate


protocol as shown in the following example. Note that the VeltiManager.h must be
imported.
#import "VeltiManager.h"

@class SampleViewController;

@interface SampleAppDelegate : NSObject <UIApplicationDelegate,


VeltiManagerDelegate> {

Add the following VeltiManagerDelegate protocol method to the application


delegate implementation file. See VeltiManager.h class reference for more detail on
this method.

- (void)veltiManagerErrorOccurred:(NSError *)error {
}

4.2 Add Initialization to The Application Delegate Class

Set the mandatory VeltiManager properties first followed by invoking the


initialize method within the applicationDidFinishLaunching method before
the key window is made visible. Note that the example below provides all
mandatory property settings and invocations. Additional VeltiManager properties
may need to be set depending upon the SDK features being used which are
discussed in the following sections.

- (void)applicationDidFinishLaunching:(UIApplication *)application {
[[VeltiManager sharedInstance] setDelegate:self];
[[VeltiManager sharedInstance] initialize];

[window addSubview:viewController.view];
[window makeKeyAndVisible];
}

© 2010 Velti S.A. Page 9/23


Velti iPhone SDK

5 Advertisements

The following sections provide discussion and code snippets that demonstrate how
to make ad requests using Velti iPhone SDK within your application.

5.1 Initialization

1. Provide the required application delegate integration. For more information,


refer to section 4 above.
2. Specify the required advertisement properties within the application
delegate applicationDidFinishLaunching method. See example below.
3. Determine whether or not routing should be enabled. See example below.

The following example illustrates the steps provided above and includes the
required advertisement properties.

- (void)applicationDidFinishLaunching:(UIApplication *)application {
...
[[VeltiManager sharedInstance] setServerUrl:@"http://server-name"];
[[VeltiManager sharedInstance] initialize];
...
}

If ad routing is to be used, enable as shown in the following example. This setting


applies to all VeltiView instances when making an ad request.

[[VeltiManager sharedInstance] setEnableRouting:TRUE];

5.2 Adopt the VeltiViewDelegate Protocol

Any controller instances responsible for managing VeltiView instance(s) must


adopt the VeltiViewDelegate protocol in the relevant controller header file. The
following example illustrates a UIViewController adoption of the protocol. Note
that the VeltiView.h must be imported.

#import "VeltiView.h"

@interface SampleViewController : UIViewController <VeltiViewDelegate> {

In the .m controller implementation file, the following VeltiViewDelegate protocol


methods must be implemented. See VeltiView.h class reference for more detail on
these methods.

© 2010 Velti S.A. Page 10/23


Velti iPhone SDK

- (void)veltiViewAdAvailable:(VeltiView *)veltiView {
}

- (void)veltiViewNoAdAvailable:(VeltiView *)veltiView {
}

- (void)veltiViewAdFinished:(VeltiView *)veltiView {
}

- (void)veltiView:(VeltiView *)veltiView errorOccurred:(NSError *)error {


}

5.3 Insert a VeltiView Object

A VeltiView instance represents the container that will display an ad and may be
added to the parent view programmatically or through Interface Builder.

Note that interstitial ads must be added programmatically.

The following sections detail various approaches for adding a VeltiView object into
your application.

5.3.1 Programmatically Add a Custom Sized VeltiView

The following example illustrates how to programmatically add a custom sized


VeltiView instance with a single ad request from a UIViewController instance
upon loading the controller's view:

- (void)viewDidLoad {
CGRect frame = CGRectMake(0.0, 0.0, 320.0, 64.0);
VeltiView *veltiView = [[VeltiView alloc] initWithFrame:frame];
[veltiView setDelegate:self];
[veltiView setName:@"unique name"];
[veltiView setPID:@"partner id"];
[veltiView setCID:@"content id"];
[veltiView requestNewAd];
[self.view addSubview:veltiView];
[veltiView release];
[super viewDidLoad];
}

5.3.2 Programmatically Add an Interstitial VeltiView

Two approaches are available by which to create an interstitial VeltiView based


upon either portrait or landscape orientation. It is the developer’s choice which
method should be used that will provide the best end user experience.

The following example illustrates how to programmatically add a portrait or


landscape interstitial VeltiView instance based upon the device orientation and is
followed by a single ad request.

© 2010 Velti S.A. Page 11/23


Velti iPhone SDK

UIDeviceOrientation o = [UIDevice currentDevice].orientation;


if (o == UIDeviceOrientationLandscapeLeft
|| o == UIDeviceOrientationLandscapeRight) {
veltiView = [[VeltiView alloc] initLandscapeInterstitial];
}
else {
veltiView = [[VeltiView alloc] initPortraitInterstitial];
}

[veltiView setDelegate:self];
[veltiView setName:@"unique name"];
[veltiView setPID:@"partner id"];
[veltiView setCID:@"content id"];
[veltiView requestNewAd];
[veltiView displayInterstital];
[veltiView release];

Note that the VeltiView is not added as a subview to a parent view.

The VeltiViewDelegate protocol provides the following method for the controller
which displayed the interstitial VeltiView to be notified when the user closes the
interstitial ad.

- (void)veltiViewAdFinished:(VeltiView *)veltiView;

5.3.3 Add a VeltiView Using Interface Builder

VeltiView instances may be created using Interface Builder. Note the following:
 The File’s Owner must provide an IBOutlet VeltiView property.
 Once the UIView instance is added which will be used to display the ad, the
VeltiView class must be specified from the Tools->Identity Inspector from
the Class drop down.
 Provide the IBOutlet connection from the VeltiView instance to the File’s
Owner corresponding VeltiView property.

© 2010 Velti S.A. Page 12/23


Velti iPhone SDK

6 Click-to-Action

The following sections provide discussion and code snippets that demonstrate how
to use the click-to-action feature provided by Velti iPhone SDK within your
application.

6.1 Initialization

1. Provide the required application delegate integration. For more information,


refer to section 4 above.
2. Set the required click-to-action properties within the application delegate
class applicationDidFinishLaunching method. See example below.
3. Delegate URL requests within the application delegate class application:
handleOpenURL: method. See example below.

The following example illustrates the steps provided above and includes the
required click to action properties.

- (void)applicationDidFinishLaunching:(UIApplication *)application {
...
[[VeltiManager sharedInstance] setEnableClickToAction:TRUE];
[[VeltiManager sharedInstance] setCPAServerUrl:@"http://server-name"];
[[VeltiManager sharedInstance] setCustomApplicationUrl:@"sample://"];
[[VeltiManager sharedInstance] setCampaign:@"campaign"];
[[VeltiManager sharedInstance] initialize];
...
}

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {


return [[VeltiManager sharedInstance] application:application handleOpenURL:url];
}

6.2 Custom Application URL

Click to action requires that your application register a custom URL scheme and
provide the value to the VeltiManager as the customApplicationUrl property.
Details on registering a custom URL scheme are provided in Apple’s documentation.

6.3 CFBundleVersion

The CFBundleVersion must be specified in the application’s plist file and is used to
identify the application version. This value is expected to conform to the following
standard defined by Apple:

CFBundleVersion (String) specifies the build version number of the bundle,


which identifies an iteration (released or unreleased) of the bundle. This is a
monotonically increased string, comprised of one or more period-separated
integers. This key is not localizable.

© 2010 Velti S.A. Page 13/23


Velti iPhone SDK

Note that the CFBundleVersion should not be confused with the


CFBundleShortVersionString which is defined by Apple as follows:

CFBundleShortVersionString (String) specifies the release version number of


the bundle, which identifies a released iteration of the application. The release
version number is a string comprised of three period-separated integers. The
first integer represents major revisions to the application, such as revisions
that implement new features or major changes. The second integer denotes
revisions that implement less prominent features. The third integer represents
maintenance releases.

6.4 CFBundleIdentifier

The CFBundleIdentifier must be specified in the application’s plist file and is used
to uniquely identify the application.

© 2010 Velti S.A. Page 14/23


Velti iPhone SDK

7 Statistics

The following sections provide discussion and code snippets that demonstrate how
to use the application statistics feature provided by Velti iPhone SDK within your
application.

7.1 Initialization

1. Provide the required application delegate integration. For more information,


refer to section 4 above.
2. Set the required statistics properties within the application delegate class
applicationDidFinishLaunching method. See example below.
3. Determine whether or not statistics should be sent upon application
termination.

Note that statistics are always sent upon application start if they have not been sent
previously. Sending statistics upon application termination can increase the time it
takes for the application to exit depending upon network speeds, however, the
statistics are immediately available without the need for a subsequent application
launch. Also note that statistics are sent only when a network connection is
available, otherwise they saved and are sent upon subsequent application launch or
termination accordingly.

The following example illustrates the steps provided above and includes the
required statistics properties.

- (void)applicationDidFinishLaunching:(UIApplication *)application {
...
[[VeltiManager sharedInstance] setEnableStatistics:TRUE];
[[VeltiManager sharedInstance] setStatisticsServerUrl:@"http://server-name"];
[[VeltiManager sharedInstance] setPID:@"partner id"];
[[VeltiManager sharedInstance] setSendStatisticsOnApplicationTermination:TRUE];
[[VeltiManager sharedInstance] initialize];
...
}

7.2 Event Logging

Various forms of event tracking are available and may be logged at any point after
the VeltiManager is initialized.

Note that the Velti iPhone SDK automatically provides a timestamp for each event collected.

The following sections discuss the available forms of event logging in more detail.

7.2.1 Standard Event Tracking

This is the simplest form of tracking an event in which the name of the event is
provided by the application as shown in the following example.

[[VeltiManager sharedInstance] logEvent:@”Standard Event”];

© 2010 Velti S.A. Page 15/23


Velti iPhone SDK

7.2.2 Event Duration Tracking

When tracking the duration of an event, the start of the event must be provided
followed by the end of the event at some point later. Note that the start and end
event names must match identically and there may be no more than one event
duration measured at any time for a given unique event name. The following
example illustrates event duration tracking.

[[VeltiManager sharedInstance] startLogEvent:@”Duration Event”];

At some point later during application processing:

[[VeltiManager sharedInstance] endLogEvent:@”Duration Event”];

Note the following:


Duration events cannot span multiple sessions.
If it has been configured to send events at the application termination
and duration events exist for which one of the endLogEvent signatures
has not been invoked, then these events are dropped and the application
delegate is notified via the veltiManagerErrorOccurred:error method
with an NSError instance that includes the name of the dangling event.
When sending events at application launch, any new events (duration
events or standard events) logged by the current application session are
queued while any previous application statistics are being sent to the
server. The window of time for this use case is extremely small and it is
not expected that it will be a common occurrence; however, it is
accounted for by the Velti iPhone SDK.

© 2010 Velti S.A. Page 16/23


Velti iPhone SDK

7.2.3 Supplementary Event Properties

Additional event properties may be provided using one of the signatures that
accepts an NSDictionary instance. Note the following NSDictionary usage
requirements:

 Keys must be NSString instances and must not exceed 255 characters.

 Values must be one of the following types: NSString, NSDate, or NSNumber.


When the statistics are sent to the server, the description method is
invoked on each value instance such that a string representation of the
contents for the receiving class is obtained. Note that the string
representation must not exceed 255 characters.

Standard events as well as event duration tracking both provide a mechanism for
specifying supplementary event properties as shown in the following examples.

NSMutableDictionary *d = [[NSMutableDictionary alloc] initWithCapacity:2];


[d setObject:@"Value 1" forKey:@"Key 1"];
[d setObject:@"Value 2" forKey:@"Key 2"];
[[VeltiManager sharedInstance] logEvent:@”Standard Event” properties:dict];
[d release];

[[VeltiManager sharedInstance] startLogEvent:@”Duration Event”];

...

NSMutableDictionary *d = [[NSMutableDictionary alloc] initWithCapacity:2];


[d setObject:@"Value 1" forKey:@"Key 1"];
[d setObject:@"Value 2" forKey:@"Key 2"];
[[VeltiManager sharedInstance] endLogEvent:@”Duration Event” properties:dict];
[d release];

7.3 Application Session Tracking

The Velti iPhone SDK automatically tracks each application launch and termination
as well as the duration of the resulting session when statistics are enabled.

7.4 Location Tracking

Application statistics may include location information provided that the feature has
been enabled. However, Apple has a strict policy that could cause your application
to be rejected. Note the following:

NOTE: Location tracking should only be enabled if your application already


uses Core Location services. Otherwise, your application will be rejected
by Apple as they require an application to use location services in a way
that is useful for the end user.

© 2010 Velti S.A. Page 17/23


Velti iPhone SDK

Two approaches for providing location statistics are available and are discussed in
the following sections.

7.4.1 Managed Location

When this property is enabled, the Velti iPhone SDK will automatically manage the
location services and provide the corresponding data to all application events
collected. This property should be set in the application delegate class before the
VeltiManager is initialized.

The following example illustrates how to enable location tracking.

- (void)applicationDidFinishLaunching:(UIApplication *)application {
...
[[VeltiManager sharedInstance] setEnableLocationTracking:TRUE];
[[VeltiManager sharedInstance] initialize];
...
}

7.4.2 Application Provided Location

Alternatively, if the application is already using core location services, then it may
provide a CLLocation instance whose data will be applied to all application events
collected from that point forward. This property may be set more than once,
however, only the most recent instance is used and any previously collected events
remained unchanged by the updated location data. This property may only be used
when enableLocationTracking is set to FALSE.

The following example illustrates how to provide a CLLocation instance which may
be done at any point while the application is running and is not required to be set
before the VeltiManager is initialized.

- (void)someMethod:(CLLocation *)location {
[[VeltiManager sharedInstance] setLocation:location];
}

7.5 CFBundleIdentifier

The CFBundleIdentifier must be specified in the application’s plist file and is used
to uniquely identify the application.

It is strongly recommended that this value be the same for each platform
where statistics are being tracked.

7.6 CFBundleShortVersionString

The CFBundleShortVersionString must be specified in the application’s plist file


and is used to identify the application version.

© 2010 Velti S.A. Page 18/23


Velti iPhone SDK

8 Additional Features

The following sections illustrate how to use additional features available in the SDK.
Note that uses of these features are optional.

8.1 Activity Indicators

Activity indicators are available which visually indicate the indeterminate progress
of an ad request and are centered horizontally and vertically within the space
allocated for a given VeltiView instance.

The following example illustrates how to enable an activity indicator for a


VeltiView instance. Activity indicators may be used for interstitial ads as well.
Note that the indicator style must be specified before the ad request is invoked.

[veltiView setActivityIndicatorViewStyle:UIActivityIndicatorViewStyleGray];

8.2 Animations

View transitions are available and provide a fade effect which occurs under the
following conditions when animations are enabled:

 When an ad is displayed following an ad request


 When displaying or dismissing an interstitial ad
 When displaying a local landing page

The following example illustrates how to enable animations and specify the duration
of the animation, in seconds, for a VeltiView instance. Note that the animation
properties must be specified before the ad request is invoked.

[veltiView setEnableAnimations:TRUE];
[veltiView setAnimationDuration:0.2l];

8.3 Local Landing Page

The local landing page feature displays click through URLs within the application
where support is available. This feature is disabled by default.

For http:// click through URLs that are not iTunes, App Store or video links, a
browser style interface with orientation change support is displayed with the
following controls:
 Back
 Forward
 Stop
 Reload
 Close button to return to the application
 Display content in Safari

For http:// click through URLs that represent video, the media player is displayed
with playback starting when a sufficient amount of data has been streamed to the
device. The following video formats are supported:

© 2010 Velti S.A. Page 19/23


Velti iPhone SDK
 .mov
 .mp4
 .mpv
 .3gp

For mailto:// click through URLs, an email composition view is displayed and
populated with the contents specified in the click through URL. Note that the local
email composition view is displayed for devices running iPhone OS 3.0 or later.
Devices with OS versions older than version 3.0 display email click through URLs in
the Mail app, thus causing the application to exit.

Note that if the click through URL represents any of the following types, the
appropriate native application is displayed causing the application to exit:
 iTunes
 App Store
 Map
 Phone
 SMS

The following example illustrates how to enable the local landing page feature and
customize the display to integrate with the application color scheme.

Enable local landing page mode in the application delegate class. This is a global
setting that applies to all VeltiView instances.

[[VeltiManager sharedInstance] setEnableLocalLandingPage:TRUE];

Configure the local landing page toolbar display for each VeltiView instance using
either the toolbar style or tint color methods. The following examples set the tool
bar style and tint color respectively.

[veltiView setToolbarStyle:UIBarStyleBlack];
[veltiView setTranslucentToolbar:FALSE];

[veltiView setToolbarTintColor:[UIColor darkGrayColor]];


[veltiView setTranslucentToolbar:FALSE];

8.4 Application Exit Confirmation

Enabling the application exit confirmation feature displays a popup dialog for the
user to confirm whether or not they want to allow the application to exit when a
click through URL is to be displayed outside of the current application space. This
feature is disabled by default.

When enabled, the popup confirmation occurs for the following scenarios:
When the local landing page feature is not enabled.
When the local landing page feature is enabled but cannot display the click
through URL for reasons cited in the Local Landing Page section above.

The following example illustrates how to enable the application confirmation exit
feature from within the application delegate class. This is a global setting that
applies to all VeltiView instances.

© 2010 Velti S.A. Page 20/23


Velti iPhone SDK

[[VeltiManager sharedInstance] setEnableApplicationExitConfirmation:TRUE];

8.5 Image Creative Auto Sizing

Enabling the image creative auto sizing feature causes an image creative to be
automatically sized to fit within the space allocated for a given VeltiView instance.
Note the following auto sizing behavior:

 Occurs only when a single creative exist within an ad unit. For example, if
auto sizing is enabled and an ad unit consists of a banner and text, the
banner is not resized.
 Maintains horizontal and vertical aspect ratios.
 Occurs only when the image dimensions are less than the dimensions
allocated for the VeltiView instance.

The following example illustrates how to enable the image creative auto sizing
feature for a given VeltiView instance. It is recommended to enable animations
when using the auto sizing feature such that a smooth transition is provided when
displaying an advertisement. Note that this property must be specified before the
ad request is invoked.

[veltiView setEnableImageCreativeAutosizing:TRUE];

8.6 Language

The two letter ISO language code may be specified for each VeltiView instance
which is provided to the server during an ad request. As such, advertisements may
be created for the SDK which target a specific language.

The following example illustrates how to specify the language code. Note that this
property must be specified before the ad request is invoked.

[veltiView setLanguage:@"en"];

8.7 Test Mode

A test mode is available which is useful to verify successful integration with the
SDK while also simulating the following features:

 Advertisement Display
 Statistics Tracking
 Click-to-Action

Test mode is executed remotely to the simulator or device and makes all requests
using demo servers. The following example illustrates how to enable test mode
from within the application delegate class.
[[VeltiManager sharedInstance] setTestMode:TRUE];

Do not forget to disable test mode prior to application distribution.

© 2010 Velti S.A. Page 21/23


Velti iPhone SDK

9 Frequently Asked Questions

The following sections contain responses to frequently asked questions.

9.1 What is the Velti iPhone SDK compatibility with iPhone SDK versions?

The following table provides a listing of the SDK version and the corresponding
compatible iPhone SDK version.

Velti iPhone SDK Version iPhone SDK Version


All Versions 2.0 and later

9.2 How do I know what version of the Velti iPhone SDK I'm using?

Expand the VeltiSDKResource.bundle and select the Info.plist file. Locate the
‘Bundle versions string, short’ and ‘Bundle version’ Keys whose value column
contain the version and build number respectively as shown in the following
screenshot. Alternatively, you can invoke getVersion or getBuildNumber from the
VeltiManager singleton instance.

9.3 Do Image Creatives Automatically Resize?

By default, when a VeltiView instance is allocated with a frame that is larger than
the image creative that it contains following an ad request, the image creative is
not automatically resized to fit within the VeltiView. The reason for this design
choice is to avoid scenarios whereby undesirable loss of image quality may occur
during resizing and thus the original size of the image creative is always respected.

However, the image creative auto size feature may be enabled for a given
VeltiView instance. For more information, see the Additional Features section
above.

© 2010 Velti S.A. Page 22/23


Velti iPhone SDK

10 Class Reference

The links below provide navigation to the API html documents that accompany the
Velti iPhone SDK and are presented in the default browser. Note that this document
must reside in the same directory as the other contents in the docs folder in order
for the links to be navigable from this document.

VeltiView.h
VeltiManager.h

© 2010 Velti S.A. Page 23/23

You might also like