Apple iPhone
From Mocean Mobile Wiki
Contents |
Apple iPhone SDK Installation
Download the latest version of the SDK:
http://developer.moceanmobile.com/Main_Page
Setup configuration for Base SDK Version: 3.1.2
There are 2 projects AdServer ( the library ) and AdServerSample ( the application ).
At first build the library for SDK 3.1.
1. Open AdServer project in the XCode.
2. Go to Projects -> Edit Project Settings, select the "Build" tab and you will see the window like the following screenshot.
3. Next set up the version of Base SDK of project to 3.1 (or 3.0 if you will use this library only for SDK 3.0) like on the following screenshot. After this step you may close the Project Settings window.
4. Now you need to change the Active SDK using for the building of the project. Go to the top left corner of the main Project window (on the screenshot the current Active SDK is "Simulator - 3.1.2 | Release" with Active Configuration set to Release)
and select from the drop down list the option like selected on the following screenshot.
After complete you need to rebuild the project and you will have the library that can be used for SDK 3.1 and 3.0 (and for earlier versions of course).
5. Next you need to replace the current library's version using on the AdServerSample project to the new version.
In the project's tree of AdServer project expand the 'Products' folder and you will see the file with name 'libAdserver.a' like on the following screenshot.
Click the right button by this file and choose Reveal in Finder and you will see this file in the local file system ( see the screenshot below ).
Copy this file to the Clipboard.
6. Next open the AdServerSample project and expand 'libs' group in the project's tree and you will see the file with name libAdserver.a.
Like the step 5 click the right mouse button on this file, choose Reveal in Finder and paste the early copied file with the same name.
7. Change the version of the Base SDK (like step 3) and Active SDK (like step 4) to the 3.1 and clean and build the project.
That's all. Now you can run the project on the Simulator 3.1 and 3.0. When you build your project, always ensure that the Base SDK under "Project"-->Build is set to the appropriate version, or the project will not compile.
If you need to run the project on the device you need make all of steps above but for Active SDK of both projects you should choose iPhone Device (compatible version of SDK) instead of iPhone Simulator (compatible version of SDK).
Webview Tutorial (for SDK 1.1.4 and onwards)
Step 1) When creating a new Interstitial, if the webview option is desired, you absolutely MUST include SampleWebView.h and SampleWebView.m in the classes folder.
Step 2) RootViewController.m MUST reference SampleWebView.h by including #import "SampleWebView.h"
Step 3) The contents of the method didAdClicked within RootViewController.m must be changed to call the SampleWebView constructor. See sample for details.
That’s it. The Adserversample is a fully functioning WebView example.
Complete Apple App Store and Certification Tutorials
Part 1- Apple Developer Portal
Part 2- Installing Development and Distribution Certificates
Part 3- Installing the WWDR Certificate
Part 4- Adding New Development Devices
Part 6- Creating Installing Development Distribution Certificates
Part 7- Compiling Apps for Distribution and ITunes setup
Application Download Tracking
To monitor the downloading of an application, there are 3 required parameters.
mode - set to MODE_COUNTER_ONLY uniqueID - Name of the application to be tracked campaign - Name of the campaign to be tracked
iPhone SDK Parameter Descriptions
| Parameter | Description | Code Example | Code Example Comments |
|---|---|---|---|
| kUpdateBunerTime (default, set in SDK) | The refresh parameter. Located in AdserverView.h in SDK | The default is currently set to 120, but can be changed in the SDK as desired. | If multiple ads are running on a single site, this parameter governs how quickly the ads rotate through. |
| kDownloadAdUrl (default, set in SDK) | The ad call parameter. Located in AdserverView.h in SDK | The default is currently set to http://ads.mocean.mobi/ad? but can be changed in the SDK as desired. | This is the address the request makes to pull the ad. |
| useCache (required) | The cache parameter. | The default is currently set to true. Boolean value-- accepts either true or false. | While ads are downloading, ads from the cache are shown. If the cache is empty or useCache is set to false, we show a default image instead. |
| initWithFrame (required) | The banner frame. | initWithFrame:CGRectMake(0, 0, 320, 50) | Marks the boundaries of the frame with Cartesian coordinates and the CGRectMake function. |
| superView (required) | a placeholder for the banner. | superView:self | Setting this parameter to "self" will not set a placeholder banner. "self" is the default value. |
| appId | id for the application | appId:@"test_1" | This is a unique identifier for the particular application Id. Optional. |
| mode (required) | type of using Adserver. MODE_COUNTER_ONLY - only counter, MODE_ADS_ONLY - only ads, MODE_COUNTER_AND_ADS -counter and ads(default) | mode:MODE_COUNTER_AND_ADS | Accepts from 4 standard input modes, as listed. |
| uniqueId | a unique id for the banner. It uses for restoring the banners data locally from the cache. | uniqueID:@"test_ad_1" | This is a unique identifier for the banner. Used mainly for caching multiple local banners. Optional. |
| campaign | The campaign title | campaign:@"test_campaign" | A local unique identifier for this particular campaign. Optional. |
| site (required) | The id of the publisher site. | site:@"5441" | Site ID of the campaign. |
| zone (required) | The id of the zone of publisher site. | zone:@"6365" | Zone ID of the campaign. |
| ip | The IP address of the carrier gateway over which the device is connecting. | ip:@"132.77.4.43" | Optional. |
| keywords | Keywords to search ad delimited by commas. | keywords:nil | Optional. |
| adsType (required) | Type of advertisement (ADS_TYPE_TEXT_ONLY - text only, ADS_TYPE_IMAGES_ONLY - image only, ADS_TYPE_TEXT_AND_IMAGES - image and text, ADS_TYPE_SMS - SMS ad). SMS will be returned in XML. | adsType:ADS_TYPE_TEXT_AND_IMAGES | The ads type must be set to one of the 4 categories: ADS_TYPE_TEXT_ONLY, ADS_TYPE_IMAGES_ONLY, ADS_TYPE_TEXT_AND_IMAGES, ADS_TYPE_SMS |
| over18 | Filter by ad over 18 content (OVER_18_TYPE_DENY - deny over 18 content , OVER_18_TYPE_ONLY - only over 18 content, OVER_18_TYPE_ALL - allow all ads including over 18 content). | over18:0 | Optional. 0 means not over 18. 1 means over 18. |
| latitude | Latitude of targeted group. Note: if set to nil, phone will autodetect location. | latitude:nil | Optional. Developer may specify specific lat/long position they wish their campaign to target. |
| longitude | Longitude of targeted group. Note: if set to nil, phone will autodetect location. | longitude:nil | Optional. Developer may specify specific lat/long position they wish their campaign to target. |
| premium | Filter by premium (PREMIUM_STATUS_NON_PREMIUM - non-premium, PREMIUM_STATUS_PREMIUM - premium only, PREMIUM_STATUS_BOTH - both). Can be used only by premium publishers. | premium:-1 | Optional. |
| key | Output format. Normal format uses key = OUTPUT_FORMAT_NORMAL. Parameter key should be set to OUTPUT_FORMAT_XML in order to use XML output and to OUTPUT_FORMAT_JSON in order to use JSON output. | key:1 | Optional. |
| testModeEnabled | Setting is test mode where, if the ad code is true, the ad response is "Test MODE". | testModeEnabled:NO | Optional. |
| count | Quantity of ads, returned by a server. Maximum value is 5. | count:1 | Optional. |
| country | Country of visitor (for example: US or DE). Will override country detected by IP. | country:nil | Optional. |
| region | Region of visitor, aka State (for example: NY, DE, CA, etc) | region:nil | Optional. |
| textborderEnabled | Show borders around text ads (false - non-borders, true - show borders). | textborderEnabled:NO | Optional. |
| paramBorder | Borders color (for example: #000000). | paramBorder:nil | Optional. |
| paramBg | Background color in borders (for example: #ffffff). | paramBG:nil | Optional. |
| carrier | Carrier name. | carrier:nil | Carrier of user's phone: Verizon, AT&T, etc. Optional. |
| imageSize | Override size detection for banners (IMAGE_SIZE_SMALLEST - the smallest, IMAGE_SIZE_LARGEST - the largest). | imageSize:-1 | Two possible parameter choices, if used. Optional. |
| target | Target attribute for <a href />(TARGET_BLANK - open the linked document in a new window, TARGET_SELF - open the linked document in the same frame, TARGET_PARENT - open the linked document in the parent frameset, TARGET_TOP - open the linked document in the full body of the window). | target:nil | Optional. |
| url | URL of site for which it is necessary to receive advertising. | url:nil | Optional. |
| pixelModeEnabled | If true, return redirect to image for ad (or tracking pixel 1x1) directly (instead of html response). | pixelModeEnabled:NO | Optional. |
| defaultImagePath | path to default image which will be displaying until the main image will not be loaded from the server. | defaultImagePath:[[NSHomeDirectory() stringByAppendingPathComponent:@"AdserverSample.app"] stringByAppendingPathComponent:@"defaultIcon.png"]]; | Default image in the event that no relevant ad is shown. |
| Add[x]WithData | Changes the [x] and [y] coordinates of the ad on a Cartesian coordinate scale | [x] May be replaced with “Adserverview,” “AdserverInterstitial,” etc depending on the type of ad that is being shown. The name of the parameters within the method call that controls this GCRect, and the centering can be changed by changing the X Y values. |
