-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Liudongfang
committed
Apr 22, 2016
0 parents
commit 8d98917
Showing
24 changed files
with
1,588 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
# 舜飞广告 iOS SDK 1.x 开发文档 | ||
|
||
## 开发环境 | ||
|
||
* Xcode 7.0 或更高版本 | ||
* 支持 iOS 6.0.0 或更高版本 | ||
|
||
## PublisherID、PlacementID、AppID | ||
|
||
从 [官网](http://mbv.biddingx.com/main/) 获取 PublisherID、PlacementID、AppID。 | ||
|
||
## SDK 集成 | ||
|
||
1、将最新的 SDK 头文件 `SuntengMobileAdsSDK.h` 、 `STMInterstitialAdController.h` 和静态库 `libSuntengMobileAdsSDK.a` 加入项目中。 | ||
|
||
2、添加需要的 Framework: | ||
|
||
```objc | ||
AdSupport.framework | ||
CoreFoundation.framework | ||
CoreGraphics.framework | ||
CoreLocation.framework | ||
CoreTelephony.framework | ||
Foundation.framework | ||
SystemConfiguration.framework | ||
UIKit.framework | ||
``` | ||
|
||
3、设置对应 **target** 的编译选项,在『Build Settings』->『Linking』->『Other Linker Flags』,添加 `-ObjC` 参数。 | ||
|
||
4、iOS 8.0+ 中获取地理位置方法,在 info.plist 里加入对应的定位请求字段,值可以为空或者填写获取定位请求提示框要显示的内容。 | ||
|
||
```objc | ||
NSLocationWhenInUseUsageDescription // 允许在前台获取GPS的描述 | ||
``` | ||
|
||
**说明:由于部分广告会定向投递到某些城市,SDK 需要获取地理位置以支持广告的定向投放。** | ||
|
||
5、Xcode 7.0+ 、iOS 9.0+ 适配 | ||
|
||
* 关于 [*ATS*](https://developer.apple.com/library/prerelease/ios/technotes/App-Transport-Security-Technote/index.html#//apple_ref/doc/uid/TP40016240) | ||
|
||
**解决方案:禁用 ATS。** | ||
|
||
在应用的 Info.plist 中添加禁用 ATS 代码。代码如下: | ||
|
||
```XML | ||
<key>NSAppTransportSecurity</key> | ||
<dict> | ||
<key>NSAllowsArbitraryLoads</key> | ||
<true/> | ||
</dict> | ||
``` | ||
|
||
* 关于 Bitcode | ||
|
||
Xcode 7.0 默认开启 **Bitcode** 编译选项(无 **Bitcode** 配置,默认为开启), SDK 1.0.0+ 版本开始支持 **Bitcode** ,如果您的工程中有其它不支持 **Bitcode** 特性的库可能编译不过。 | ||
|
||
**解决方案:请将项目对应『Target』->『Build Settings』->『Build Options』->『Enable Bitcode』选项设置为 No 。** | ||
|
||
## SDK 使用 | ||
|
||
### 初始化 SDK | ||
|
||
```objc | ||
#import "SuntengMobileAdsSDK.h" | ||
|
||
@interface ViewController () | ||
|
||
@property(nonatomic, weak) STMInterstitialAdController *interstitialAdController; | ||
|
||
@end | ||
|
||
@implementation ViewController | ||
|
||
- (void)viewDidLoad { | ||
[super viewDidLoad]; | ||
|
||
self.interstitialAdController = [STMInterstitialAdController interstitialAdControllerWithPublishedId:@"1" | ||
appId:@"2" | ||
placementId:@"3"]; | ||
} | ||
|
||
@end | ||
``` | ||
### 展示插屏广告 | ||
当您需要展示插屏广告时,请在尝试展示之前检查它是否已准备就绪。 | ||
```objc | ||
if (self.interstitialAdController.isLoaded) { | ||
[self.interstitialAdController presentFromViewController:self]; | ||
} | ||
``` | ||
|
||
### 跟踪广告生命周期 | ||
|
||
您可以通过实现 `STMInterstitialAdControllerDelegate ` 中定义的协议,来跟踪广告生命周期中的各个阶段。所有方法定义如下: | ||
|
||
```objc | ||
@protocol STMInterstitialAdControllerDelegate <NSObject> | ||
|
||
@optional | ||
|
||
// 当插屏广告被成功加载后,回调该方法 | ||
- (void)interstitialDidLoad:(STMInterstitialAdController *)interstitial; | ||
|
||
// 当插屏广告加载失败后,回调该方法 | ||
- (void)interstitialDidLoadFail:(STMInterstitialAdController *)interstitial; | ||
|
||
// 当插屏广告展示出来时,回调该方法 | ||
- (void)interstitialDidPresent:(STMInterstitialAdController *)interstitial; | ||
|
||
// 当用户点击广告,回调该方法 | ||
- (void)interstitialDidTap:(STMInterstitialAdController *)interstitial; | ||
|
||
// 当插屏广告被关闭后,回调该方法 | ||
- (void)interstitialDidDismiss:(STMInterstitialAdController *)interstitial; | ||
|
||
@end | ||
``` | ||
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# suntengMob-sdk-ios for iOS | ||
|
||
移动广告 SDK | ||
|
||
## 如何使用 | ||
|
||
- [Getting Started with SDK](https://github.com/shunfei/suntengMob-sdk-ios/blob/master/Docs/Getting_Started.md) | ||
|
||
## Change Log | ||
04/22/2016 - v1.0.0 | ||
|
||
* initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// | ||
// STMInterstitialAdController.h | ||
// SuntengMobileAdsSDK | ||
// | ||
// Created by Joe. | ||
// Copyright © 2016年 Sunteng Information Technology Co., Ltd. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@protocol STMInterstitialAdControllerDelegate; | ||
|
||
@interface STMInterstitialAdController : UIViewController | ||
|
||
/** | ||
* Create and return a `STMInterstitialAdController` instance | ||
* | ||
* @param adUnitID The ad unit ID | ||
* | ||
* @return A `STMInterstitialAdController` instance | ||
*/ | ||
+ (instancetype)interstitialAdControllerWithPublishedId:(NSString *)publishedId | ||
appId:(NSString *)appId | ||
placementId:(NSString *)placementId; | ||
|
||
/** | ||
* The ad unit ID | ||
*/ | ||
@property (nonatomic, copy, readonly) NSString *adUnitID; | ||
|
||
/** | ||
* `STMInterstitialAdController` delegate | ||
*/ | ||
@property (nonatomic, weak) id<STMInterstitialAdControllerDelegate> delegate; | ||
|
||
/** | ||
* Load ad | ||
*/ | ||
- (void)loadAd; | ||
|
||
/** | ||
* check is ad loaded and ready to show | ||
*/ | ||
@property (nonatomic, assign, readonly, getter=isLoaded) BOOL loaded; | ||
|
||
/** | ||
* Present ad from the given controller | ||
* | ||
* @param controller Ad present from this controller | ||
*/ | ||
- (void)presentFromViewController:(UIViewController *)controller; | ||
|
||
@end | ||
|
||
///------------------------------------------ | ||
/// @name STMInterstitialAdControllerDelegate | ||
///------------------------------------------ | ||
|
||
@protocol STMInterstitialAdControllerDelegate <NSObject> | ||
|
||
@optional | ||
|
||
- (void)interstitialDidLoad:(STMInterstitialAdController *)interstitial; | ||
|
||
- (void)interstitialDidLoadFail:(STMInterstitialAdController *)interstitial; | ||
|
||
- (void)interstitialDidPresent:(STMInterstitialAdController *)interstitial; | ||
|
||
- (void)interstitialDidTap:(STMInterstitialAdController *)interstitial; | ||
|
||
- (void)interstitialDidDismiss:(STMInterstitialAdController *)interstitial; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// | ||
// SuntengMobileAdsSDK.h | ||
// SuntengMobileAdsSDK | ||
// | ||
// Created by Joe. | ||
// Copyright © 2016年 Sunteng Information Technology Co., Ltd. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import "STMInterstitialAdController.h" | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
/** | ||
* Sunteng mobile ad SDK version. | ||
*/ | ||
extern NSString * const STMAdsSDKVersion; | ||
|
||
@interface SuntengMobileAdsSDK : NSObject | ||
|
||
/** | ||
* The sunteng mobile ads SDK singleton object. | ||
* | ||
* @return The sunteng mobile ads SDK singleton object. | ||
*/ | ||
+ (instancetype)sharedInstance; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
Binary file not shown.
Oops, something went wrong.