The Swelen Mobile Manager SDK is provided as a static library that will be
linked directly against your application using Xcode.
This library is named libswAdLib.a and is compatible with iOS 4.0 or later.
1. Import the SDK folder in your Xcode Project
To do this, simply locate the SwelenSDK folder and drag it onto the root
node of your Xcode project.
When asked, click on the checkbox to tell Xcode to
copy the files into the project folder (Copy items into destination group's
folder).
Select the "Recursively create groups for any added folder" option and
click the Finish button.
2. Add the AVFoundation, SystemConfiguration, CoreMotion, MediaPlayer and CoreGraphics to your project.
In order to add these Frameworks, go to the TARGETS menu of your project and click the "Build Phases" tab.
Collapse the "Link Binary With Libraries" menu and add every framework listed above.
3. Get your slot UID from Swelen and set it in your delegate.
To find your slot UID, log into your Swelen Aaccount, click on
“Sites and Applications”, select an application then copy the desired slot UID.
4. Add the following line into the import section of the view where you want ads.
#import "swAdAPI.h"
The library expose a singleton available to the developer using the following :
[swAdMain sharedSwAd]
The implementation must be done after the application as successfully loaded its main view.
The singleton object expose a single method named "runWithSlot:" with differents parameters :
Example :
swAdSlot *slot = [[swAdMain sharedSwAd] runWithSlot:@"___YOUR_SLOT_UID___" delegate:self];
Note: The returned value (swAdSlot object) is useful to handle callback (see below)
Each swAdSlot object has an unique "tag" member value (integer)
1. Create an UIView object named fixedAdSlot in the @interface of your .h header file
@interface {
IBOutlet UIView *fixedAdSlot;
}
2. Open Interface Builder and place a 320x50 UIView where you want ads to appear.
Then set the view outlet to the fixedAdSlot object. (Make sure you set the "view"
outlet of the "File's Owner" appropriately).
3. In your code, you need to set the API to display ads within the UIView. This can be done with attachTo, like this:
[[swAdMain sharedSwAd] runWithSlot:@"___YOUR_SLOT_UID___" delegate:self attachTo:fixedAdSlot];
Swelen ads will now be displayed in the fixedAdSlot UIView.
Changes in 40000b
Changes in 40000a
Developers interested in getting more control over the implementation can add
the following methods in
the instantiation delegate:
- (void) swAdVideoDidStartPlaying; /* Called when a video ad starts playing so you can pause any other playing of audio/video in your app */ - (void) swAdVideoDidStopPlaying; - (void) swAdDidFail:(swAdSlot *)slot args:(id)args; - (void) swAdDidClose:(swAdSlot *)slot args:(id)args; - (void) swAdDidReceiveClick:(swAdSlot *)slot args:(id)args;
The conversion can be instantiated anywhere. This is an example for Download Tracking, where the instanciation is defined
in applicationDidFinishLaunching. You can use viewDidLoad as well.
- (void)applicationDidFinishLaunching:(UIApplication *)application {
// .. .... ...
[[[swAdMain] sharedSwAd] registerConversion:@"--CONVERSION-UID--" mode:SwConversionModeUnique];
}
Replace --CONVERSION-UID-- with the UID you have defined on Swelen (in the Conversion Goals tab of an application).
SwConversionModeUnique : the conversion will be registered only one time
SwConversionModeMultiple : the conversion will be registered each time
The following modes wil be implemented soon, in a futur version:
(soon) SwConversionModeUniquePerVersion : the conversion will be registered only one time per application's version
(soon) SwConversionModeUniquePerSession : the conversion will be registered only one time per session
If the application knowns the current position of the device, you can specify it to the SDK.
The geotargeting parameter is a CGPoint struct:
Important Notes about geotargeted mobile advertising:
If you build your application with features based on a user's location, make sure these features provide beneficial information and real value to your users. If your app uses location-based information primarily to enable mobile advertisers to deliver targeted ads based on a user's location, your app will be rejected by the App Store Review Team for modification before it can be posted to the App Store.
The application can provide a custom user agent with the UA: parameter.