diff --git a/Docs/Getting_Started.md b/Docs/Getting_Started.md index a2d9c9e..1b37bb5 100644 --- a/Docs/Getting_Started.md +++ b/Docs/Getting_Started.md @@ -1,4 +1,4 @@ -# 舜飞移动广告 SDK iOS 版 v1.x.x 开发文档 +# 舜飞移动广告 SDK iOS 版 v2.x.x 开发文档 ## 1、开发环境 @@ -9,13 +9,12 @@ ## 2、SDK 集成 -2.1、将最新的 SDK 文件夹,包含头文件 `SuntengMobileAdsSDK.h` 、 `STMBannerView.h` 、 `STMInterstitialAdController.h` 、 `STMSplashAd.h` 和静态库 `libSuntengMobileAdsSDK.a` 加入项目中。 +2.1、将最新的 SDK 文件夹,包含头文件 `SuntengMobileAdsSDK.h` 、 `STMConstants.h` 、 `STMBannerView.h` 、 `STMInterstitialAdController.h` 、 `STMSplashAd.h` 和静态库 `libSuntengMobileAdsSDK.a` 加入项目中。 2.2、添加需要的 Framework: ```objc AdSupport.framework -CoreFoundation.framework CoreGraphics.framework CoreLocation.framework CoreTelephony.framework @@ -31,8 +30,11 @@ UIKit.framework 在 info.plist 里加入对应的定位请求字段,值可以为空或者填写获取定位请求提示框要显示的内容。 -```objc -NSLocationWhenInUseUsageDescription // 允许在前台获取GPS的描述 +```XML +NSLocationWhenInUseUsageDescription +iOS 8 定位权限请求提示语! +NSLocationUsageDescription +iOS 10 定位权限请求提示语! ``` **说明:由于部分广告会定向投递到某些城市,SDK 需要获取地理位置以支持广告的定向投放。** @@ -72,15 +74,14 @@ NSLocationWhenInUseUsageDescription // 允许在前台获取GPS的描述 #### 3.1.1、初始化横幅 SDK ```objc -self.bannerView = [[STMBannerView alloc] initWithPublishedId:@"1" - appId:@"2" - placementId:@"4" - frame:CGRectMake(0, 0, 320, 50)]; +self.bannerView = [[STMBannerView alloc] initWithPublisherID:@"2" + appID:@"36" + placementID:@"35" + appKey:@"Ac7Kd3lJ^KQX9Hjkn_Z(UO9jqViFh*q1" + frame:CGRectMake(0, 64, 320, 50)]; [self.bannerView loadAd]; ``` -**建议使用 Banner 尺寸 320x50、640x100、1080x120,单位为像素。** - #### 3.1.2、展示横幅广告 ```objc @@ -130,9 +131,10 @@ if (self.bannerView.isLoaded) { #### 3.2.1、初始化插屏 SDK ```objc -self.interstitialAdController = [STMInterstitialAdController interstitialAdControllerWithPublishedId:@"1" - appId:@"2" - placementId:@"3"]; +self.interstitialAdController = [STMInterstitialAdController interstitialAdControllerWithPublisherID:@"2" + appID:@"36" + placementID:@"36" + appKey:@"Ac7Kd3lJ^KQX9Hjkn_Z(UO9jqViFh*q1"]; ``` #### 3.2.2、展示插屏广告 @@ -190,9 +192,11 @@ if (self.interstitialAdController.isLoaded) { [self.window makeKeyAndVisible]; // 初始化开屏 SDK - self.splashAd = [STMSplashAd splashAdWithPublishedId:@"1" - appId:@"2" - placementId:@"5"]; + self.splashAd = [STMSplashAd splashAdWithPublisherID:@"2" + appID:@"36" + placementID:@"34" + appKey:@"Ac7Kd3lJ^KQX9Hjkn_Z(UO9jqViFh*q1"]; + self.splashAd.delegate = self; // 展示开屏广告 @@ -212,7 +216,7 @@ if (self.interstitialAdController.isLoaded) { - (void)splashDidPresent:(STMSplashAd *)splash; // 当开屏广告展示失败后,回调该方法 -- (void)splashlFailPresent:(STMSplashAd *)splash; +- (void)splashFailPresent:(STMSplashAd *)splash; // 当用户点击广告,回调该方法 - (void)splashDidTap:(STMSplashAd *)splash; @@ -223,8 +227,10 @@ if (self.interstitialAdController.isLoaded) { #### 3.3.2、设置实时开屏广告请求超时时间 -当本地没有缓存的开屏广告或者本地已缓存广告超时, SDK 会发起实时开屏广告请求,实时开屏广告超时时间默认设定为 2 秒,以提高用户体验。您可以通过以下方法自定义超时时间,以提高实时开屏广告展示的成功几率。**强烈建议您保持该设置以提高用户体验!** +开屏广告混合了缓存的开屏广告和实时获取功能。当本地没有缓存的开屏广告或者本地已缓存广告超时时, SDK 会发起实时开屏广告请求,实时开屏广告超时时间内默认设定为 2 秒,以提高用户体验。您可以通过以下方法自定义超时时间,以提高实时开屏广告展示的成功几率。 ```objc - (void)setRealtimeSplashTimeoutInterval:(CGFloat)interval; ``` + + diff --git "a/Docs/\350\210\234\351\243\236\347\247\273\345\212\250\345\271\277\345\221\212SDK\345\274\200\345\217\221\346\226\207\346\241\243.html" "b/Docs/\350\210\234\351\243\236\347\247\273\345\212\250\345\271\277\345\221\212SDK\345\274\200\345\217\221\346\226\207\346\241\243.html" index ef6a767..2e6b737 100644 --- "a/Docs/\350\210\234\351\243\236\347\247\273\345\212\250\345\271\277\345\221\212SDK\345\274\200\345\217\221\346\226\207\346\241\243.html" +++ "b/Docs/\350\210\234\351\243\236\347\247\273\345\212\250\345\271\277\345\221\212SDK\345\274\200\345\217\221\346\226\207\346\241\243.html" @@ -1,211 +1,509 @@ - - + + + - - - Getting_Started - - -.hljs-class .hljs-title, -.haskell .hljs-type, -.vhdl .hljs-literal, -.tex .hljs-command { - color: #458; - font-weight: bold + - - -
-

舜飞移动广告 SDK iOS 版 v1.x.x 开发文档

-

1、开发环境

+ + +

舜飞移动广告 SDK iOS 版 v2.x.x 开发文档

+ +

1、开发环境

-

关于 PublisherIDPlacementIDAppID 。请从 官网 获取 PublisherID、PlacementID、AppID。

-

2、SDK 集成

+

2、SDK 集成

-

2.1、将最新的 SDK 文件夹,包含头文件 SuntengMobileAdsSDK.hSTMBannerView.hSTMInterstitialAdController.hSTMSplashAd.h 和静态库 libSuntengMobileAdsSDK.a 加入项目中。

+

2.1、将最新的 SDK 文件夹,包含头文件 SuntengMobileAdsSDK.hSTMConstants.hSTMBannerView.hSTMInterstitialAdController.hSTMSplashAd.h 和静态库 libSuntengMobileAdsSDK.a 加入项目中。

2.2、添加需要的 Framework:

-
AdSupport.framework
-CoreFoundation.framework
+
AdSupport.framework
 CoreGraphics.framework
 CoreLocation.framework
 CoreTelephony.framework
 Foundation.framework
 StoreKit.framework
 SystemConfiguration.framework
-UIKit.framework
- +UIKit.framework
-

2.3、设置对应 target 的编译选项,在『Build Settings』->『Linking』->『Other Linker Flags』,添加 -ObjC 参数。

+

2.3、设置对应 target 的编译选项,在『Build Settings』->『Linking』->『Other Linker Flags』,添加 -ObjC 参数。

2.4、iOS 8.0+ 获取地理位置适配

在 info.plist 里加入对应的定位请求字段,值可以为空或者填写获取定位请求提示框要显示的内容。

-
NSLocationWhenInUseUsageDescription   // 允许在前台获取GPS的描述
- +
<key>NSLocationWhenInUseUsageDescription</key>
+<string>iOS 8 定位权限请求提示语!</string>
+<key>NSLocationUsageDescription</key>
+<string>iOS 10 定位权限请求提示语!</string>

说明:由于部分广告会定向投递到某些城市,SDK 需要获取地理位置以支持广告的定向投放。

@@ -214,60 +512,53 @@

2、SDK 集成

- -
<key>NSAppTransportSecurity</key>
+
<key>NSAppTransportSecurity</key>
 <dict>
-	<key>NSAllowsArbitraryLoads</key>
-	<true/>
-</dict>
- + <key>NSAllowsArbitraryLoads</key> + <true/> +</dict>
+

3、SDK 使用

-

3、SDK 使用

- -

3.1、横幅 SDK

+

3.1、横幅 SDK

在使用 SDK 的代码中加入头文件。

-
#import "SuntengMobileAdsSDK.h"
- - -

3.1.1、初始化横幅 SDK

- -
self.bannerView = [[STMBannerView alloc] initWithPublishedId:@"1"
-                                                       appId:@"2"
-                                                 placementId:@"4"
-                                                       frame:CGRectMake(0, 0, 320, 50)];
-[self.bannerView loadAd];
+
#import "SuntengMobileAdsSDK.h"
+

3.1.1、初始化横幅 SDK

-

建议使用 Banner 尺寸 320x50、640x100、1080x120,单位为像素。

+
self.bannerView = [[STMBannerView alloc] initWithPublisherID:@"2"
+                                                           appID:@"36"
+                                                     placementID:@"35"
+                                                           appKey:@"Ac7Kd3lJ^KQX9Hjkn_Z(UO9jqViFh*q1"
+                                                           frame:CGRectMake(0, 64, 320, 50)];
+[self.bannerView loadAd];
-

3.1.2、展示横幅广告

+

3.1.2、展示横幅广告

-
if (self.bannerView.isLoaded) {
+
if (self.bannerView.isLoaded) {
     [self.view addSubview:self.bannerView];
-}
+}
- -

3.1.3、跟踪横幅广告生命周期

+

3.1.3、跟踪横幅广告生命周期

您可以通过实现 STMBannerViewDelegate 中定义的协议,来跟踪广告生命周期中的各个阶段。所有方法定义如下:

-
// 当横幅广告被成功加载后,回调该方法
+
// 当横幅广告被成功加载后,回调该方法
 - (void)bannerViewDidLoadAd:(STMBannerView *)bannerView;
 
 // 当横幅广告加载失败后,回调该方法
@@ -277,48 +568,44 @@ 

3.1.3、跟踪横幅广告生 - (void)bannerViewDidTap:(STMBannerView *)bannerView; // 当横幅广告被关闭后,回调该方法 -- (void)bannerViewDidDismiss:(STMBannerView *)bannerView;

- +- (void)bannerViewDidDismiss:(STMBannerView *)bannerView;
-

3.1.4、优化横幅广告获取、展示

+

3.1.4、优化横幅广告获取、展示

在横幅广告不在界面展示时,建议开发者使用以下两个方法暂停和恢复广告的自动刷新,减少在无展示时的刷新行为。

-
// 手动停止 Banner 自动刷新
+
// 手动停止 Banner 自动刷新
 - (void)stopAutomaticallyRefreshingAd;
 
 // 恢复 Banner 自动刷新
-- (void)startAutomaticallyRefreshingAd;
+- (void)startAutomaticallyRefreshingAd;
- -

3.2、插屏 SDK

+

3.2、插屏 SDK

在使用 SDK 的代码中加入头文件。

-
#import "SuntengMobileAdsSDK.h"
- +
#import "SuntengMobileAdsSDK.h"
-

3.2.1、初始化插屏 SDK

+

3.2.1、初始化插屏 SDK

-
self.interstitialAdController = [STMInterstitialAdController interstitialAdControllerWithPublishedId:@"1"
-                                                                                               appId:@"2"
-                                                                                         placementId:@"3"];
+
self.interstitialAdController = [STMInterstitialAdController interstitialAdControllerWithPublisherID:@"2"
+                                                                                                   appID:@"36"
+                                                                                             placementID:@"36"
+                                                                                                  appKey:@"Ac7Kd3lJ^KQX9Hjkn_Z(UO9jqViFh*q1"];
- -

3.2.2、展示插屏广告

+

3.2.2、展示插屏广告

当您需要展示插屏广告时,请在尝试展示之前检查它是否已准备就绪。

-
if (self.interstitialAdController.isLoaded) {
-	[self.interstitialAdController presentFromViewController:self];
-} 
- +
if (self.interstitialAdController.isLoaded) {
+    [self.interstitialAdController presentFromViewController:self];
+} 
-

3.2.3、跟踪插屏广告生命周期

+

3.2.3、跟踪插屏广告生命周期

您可以通过实现 STMInterstitialAdControllerDelegate 中定义的协议,来跟踪广告生命周期中的各个阶段。所有方法定义如下:

-
// 当插屏广告被成功加载后,回调该方法
+
// 当插屏广告被成功加载后,回调该方法
 - (void)interstitialDidLoad:(STMInterstitialAdController *)interstitial;
 
 // 当插屏广告加载失败后,回调该方法
@@ -331,19 +618,17 @@ 

3.2.3、跟踪插屏广告生 - (void)interstitialDidTap:(STMInterstitialAdController *)interstitial; // 当插屏广告被关闭后,回调该方法 -- (void)interstitialDidDismiss:(STMInterstitialAdController *)interstitial;

- +- (void)interstitialDidDismiss:(STMInterstitialAdController *)interstitial;
-

3.3、开屏 SDK

+

3.3、开屏 SDK

在使用 SDK 的代码中加入头文件。

-
#import "SuntengMobileAdsSDK.h"
+
#import "SuntengMobileAdsSDK.h"
+

3.3.1、初始化开屏 SDK、展示开屏广告

-

3.3.1、初始化开屏 SDK、展示开屏广告

- -
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
     //Override point for customization after application launch.
     
     // 从 MainStoryboard 加载 rootViewController
@@ -356,9 +641,11 @@ 

3.3.1、初始化开 [self.window makeKeyAndVisible]; // 初始化开屏 SDK - self.splashAd = [STMSplashAd splashAdWithPublishedId:@"1" - appId:@"2" - placementId:@"5"]; + self.splashAd = [STMSplashAd splashAdWithPublisherID:@"2" + appID:@"36" + placementID:@"34" + appKey:@"Ac7Kd3lJ^KQX9Hjkn_Z(UO9jqViFh*q1"]; + self.splashAd.delegate = self; // 展示开屏广告 @@ -366,47 +653,49 @@

3.3.1、初始化开 backgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"LaunchImage"]]]; return YES; -}

+}
- -

3.3.2、跟踪开屏广告生命周期

+

3.3.2、跟踪开屏广告生命周期

您可以通过实现 STMSplashAdDelegate 中定义的协议,来跟踪广告生命周期中的各个阶段。所有方法定义如下:

-
// 当开屏广告被成功展示后,回调该方法
+
// 当开屏广告被成功展示后,回调该方法
 - (void)splashDidPresent:(STMSplashAd *)splash;
 
 // 当开屏广告展示失败后,回调该方法
-- (void)splashlFailPresent:(STMSplashAd *)splash;
+- (void)splashFailPresent:(STMSplashAd *)splash;
 
 // 当用户点击广告,回调该方法
 - (void)splashDidTap:(STMSplashAd *)splash;
 
 // 当开屏广告被关闭后,回调该方法
-- (void)splashDidDismiss:(STMSplashAd *)splash;
- +- (void)splashDidDismiss:(STMSplashAd *)splash;
-

3.3.2、设置实时开屏广告请求超时时间

+

3.3.2、设置实时开屏广告请求超时时间

-

当本地没有缓存的开屏广告或者本地已缓存广告超时, SDK 会发起实时开屏广告请求,实时开屏广告超时时间默认设定为 2 秒,以提高用户体验。您可以通过以下方法自定义超时时间,以提高实时开屏广告展示的成功几率。强烈建议您保持该设置以提高用户体验!

+

开屏广告混合了缓存的开屏广告和实时获取功能。当本地没有缓存的开屏广告或者本地已缓存广告超时时, SDK 会发起实时开屏广告请求,实时开屏广告超时时间内默认设定为 2 秒,以提高用户体验。您可以通过以下方法自定义超时时间,以提高实时开屏广告展示的成功几率。

-
- (void)setRealtimeSplashTimeoutInterval:(CGFloat)interval;
+
- (void)setRealtimeSplashTimeoutInterval:(CGFloat)interval;
+ -
- - - -
+ + + - - - - - \ No newline at end of file + + diff --git a/README.md b/README.md index 9e166aa..f5c9e03 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,11 @@ ## Change Log +11/09/2016 - v2.0.3 + +* Update API. +* bugs fixes. + 06/20/2016 - v1.1.0 * add splash and banner ad. diff --git a/STMobSDK/STMBannerView.h b/STMobSDK/STMBannerView.h index f44ded3..292c2e2 100644 --- a/STMobSDK/STMBannerView.h +++ b/STMobSDK/STMBannerView.h @@ -7,6 +7,7 @@ // #import +#import "STMConstants.h" NS_ASSUME_NONNULL_BEGIN @@ -21,25 +22,42 @@ NS_ASSUME_NONNULL_BEGIN /** * Create and return a `STMBannerView` instance. * - * @param publishedId The published id. - * @param appId The app id. - * @param placementId The placement id. + * @param publisherID The publisher ID. + * @param appID The app ID. + * @param placementID The placement ID. + * @param appKey The app key. * @param frame The banner view frame. * * @return A `STMInterstitialAdController` instance. */ -- (nullable instancetype)initWithPublishedId:(NSString *)publishedId - appId:(NSString *)appId - placementId:(NSString *)placementId +- (nullable instancetype)initWithPublisherID:(NSString *)publisherID + appID:(NSString *)appID + placementID:(NSString *)placementID + appKey:(NSString *)appKey frame:(CGRect)frame; -- (instancetype)init __attribute__((unavailable("can not use `- init` method, please use `- initWithPublishedId:appId:placementId:frame:` method"))); -+ (instancetype)new __attribute__((unavailable("can not use `+ new` method, please use `- initWithPublishedId:appId:placementId:frame:` method"))); +- (instancetype)init __attribute__((unavailable("can not use `- init` method, please use `- initWithPublisherId:appId:placementId:appKey:frame:` method"))); ++ (instancetype)new __attribute__((unavailable("can not use `+ new` method, please use `- initWithPublisherId:appId:placementId:appKey:frame:` method"))); /** - * The placement Id. + * The poublisher ID. */ -@property (nonatomic, copy, readonly) NSString *adUnitID; +@property (nonatomic, copy, readonly) NSString *publisherID; + +/** + * The app ID. + */ +@property (nonatomic, copy, readonly) NSString *appID; + +/** + * The placement ID. + */ +@property (nonatomic, copy, readonly) NSString *placementID; + +/** + * The app key. + */ +@property (nonatomic, copy, readonly) NSString *appKey; /** * The `STMBannerView` delegate. diff --git a/STMobSDK/STMConstants.h b/STMobSDK/STMConstants.h new file mode 100644 index 0000000..1524c42 --- /dev/null +++ b/STMobSDK/STMConstants.h @@ -0,0 +1,27 @@ +// +// STMConstants.h +// SuntengMobileAdsSDK +// +// Created by Joe. +// Copyright © 2016年 Sunteng Information Technology Co., Ltd. All rights reserved. +// + +#import + +extern NSString * const STMErrorDomain; + +typedef NS_ENUM(NSInteger, STMErrorCode) { + STMErrorCodeNone = 0, // bidding success + STMErrorCodeNetworkError, // network error + STMErrorCodeResponseError, // response is not a HTTP URL response + STMErrorCodeSystemError, // server system error + STMErrorCodeNoAd, // no ad + STMErrorCodeNoData, // no response data + STMErrorCodeDeserializationError, // deserialize JSON error + STMErrorCodeLoadHTMLFail, // load HTML fail + STMErrorCodeErrorRequest, // error request - HTTP code 204 + STMErrorCodeRefund, // no ad - refund + STMErrorCodeBlank, // no ad - keep blank + STMErrorCodeTimeout, // timeout + STMErrorCodeOther = -1 // other error +}; diff --git a/STMobSDK/STMInterstitialAdController.h b/STMobSDK/STMInterstitialAdController.h index f49c708..4e551b7 100644 --- a/STMobSDK/STMInterstitialAdController.h +++ b/STMobSDK/STMInterstitialAdController.h @@ -7,6 +7,7 @@ // #import +#import "STMConstants.h" NS_ASSUME_NONNULL_BEGIN @@ -21,23 +22,41 @@ NS_ASSUME_NONNULL_BEGIN /** * Create and return a `STMInterstitialAdController` instance. * - * @param publishedId The published id. - * @param appId The app id. - * @param placementId The placement id. + * @param publisherID The publisher ID. + * @param appID The app ID. + * @param placementID The placement ID. + * @param appKey The app key. * * @return A `STMInterstitialAdController` instance. */ -+ (nullable instancetype)interstitialAdControllerWithPublishedId:(NSString *)publishedId - appId:(NSString *)appId - placementId:(NSString *)placementId; ++ (nullable instancetype)interstitialAdControllerWithPublisherID:(NSString *)publisherID + appID:(NSString *)appID + placementID:(NSString *)placementID + appKey:(NSString *)appKey; -- (instancetype)init __attribute__((unavailable("can not use `- init` method, please use `+ interstitialAdControllerWithPublishedId:appId:placementId:` method"))); -+ (instancetype)new __attribute__((unavailable("can not use `+ new` method, please use `+ interstitialAdControllerWithPublishedId:appId:placementId:` method"))); +- (instancetype)init __attribute__((unavailable("can not use `- init` method, please use `+ interstitialAdControllerWithPublisherID:appID:placementID:appKey:` method"))); ++ (instancetype)new __attribute__((unavailable("can not use `+ new` method, please use `+ interstitialAdControllerWithPublisherID:appID:placementID:appKey:` method"))); /** - * The placement Id. + * The publisher ID. */ -@property (nonatomic, copy, readonly) NSString *adUnitID; +@property (nonatomic, copy, readonly) NSString *publisherID; + +/** + * The app ID. + */ +@property (nonatomic, copy, readonly) NSString *appID; + +/** + * The placement ID. + */ +@property (nonatomic, copy, readonly) NSString *placementID; + +/** + * The appKey. + */ +@property (nonatomic, copy, readonly) NSString *appKey; + /** * The `STMInterstitialAdController` delegate. @@ -83,7 +102,7 @@ NS_ASSUME_NONNULL_BEGIN * * @param interstitial The `STMInterstitialAdController` instance. */ -- (void)interstitialDidLoadFail:(STMInterstitialAdController *)interstitial; +- (void)interstitial:(STMInterstitialAdController *)interstitial didLoadFailWithError:(NSError *)error; /** * The interstitial ad presented. diff --git a/STMobSDK/STMSplashAd.h b/STMobSDK/STMSplashAd.h index 5f0aaa4..1e777f2 100644 --- a/STMobSDK/STMSplashAd.h +++ b/STMobSDK/STMSplashAd.h @@ -6,8 +6,9 @@ // Copyright © 2016年 Sunteng Information Technology Co., Ltd. All rights reserved. // -#import #import +#import +#import "STMConstants.h" NS_ASSUME_NONNULL_BEGIN @@ -22,23 +23,40 @@ NS_ASSUME_NONNULL_BEGIN /** * Create and return a `STMSplashAd` instance. * - * @param publishedId The published id. - * @param appId The app id. - * @param placementId The placement id. + * @param publisherID The publisher ID. + * @param appID The app ID. + * @param placementID The placement ID. + * @param appKey The app key. * * @return A `STMSplashAd` instance. */ -+ (nullable instancetype)splashAdWithPublishedId:(NSString *)publishedId - appId:(NSString *)appId - placementId:(NSString *)placementId; ++ (nullable instancetype)splashAdWithPublisherID:(NSString *)publisherID + appID:(NSString *)appID + placementID:(NSString *)placementID + appKey:(NSString *)appKey; + +- (instancetype)init __attribute__((unavailable("can not use `- init` method, please use `+ initWithPublisherID:appID:placementID:appKey:` method"))); ++ (instancetype)new __attribute__((unavailable("can not use `+ new` method, please use `+ initWithPublisherID:appID:placementID:appKey:` method"))); + +/** + * The publisher ID + */ +@property (nonatomic, copy, readonly) NSString *publisherID; -- (instancetype)init __attribute__((unavailable("can not use `- init` method, please use `+ initWithPublishedId:appId:placementId:` method"))); -+ (instancetype)new __attribute__((unavailable("can not use `+ new` method, please use `+ initWithPublishedId:appId:placementId:` method"))); +/** + * The app ID + */ +@property (nonatomic, copy, readonly) NSString *appID; + +/** + * The placement ID + */ +@property (nonatomic, copy, readonly) NSString *placementID; /** - * The placement Id + * The appKey */ -@property (nonatomic, copy, readonly) NSString *adUnitID; +@property (nonatomic, copy, readonly) NSString *appKey; /** * The `STMSplashAd` delegate. @@ -87,7 +105,7 @@ NS_ASSUME_NONNULL_BEGIN * * @param splash The `STMSplashAd` instance. */ -- (void)splashlFailPresent:(STMSplashAd *)splash; +- (void)splash:(STMSplashAd *)splash failPresentWithError:(NSError *)error; /** * The splash ad tapped. diff --git a/STMobSDK/SuntengMobileAdsSDK.h b/STMobSDK/SuntengMobileAdsSDK.h index d38bee5..ece8612 100644 --- a/STMobSDK/SuntengMobileAdsSDK.h +++ b/STMobSDK/SuntengMobileAdsSDK.h @@ -13,11 +13,6 @@ NS_ASSUME_NONNULL_BEGIN -/** - * Sunteng mobile ad SDK version. - */ -extern NSString * const STMAdsSDKVersion; - @interface SuntengMobileAdsSDK : NSObject /** @@ -27,6 +22,11 @@ extern NSString * const STMAdsSDKVersion; */ + (instancetype)sharedInstance; +/** + * Sunteng mobile ad SDK version. + */ +@property (nonatomic, strong, readonly) NSString *version; + - (instancetype)init __attribute__((unavailable("can not use `- init` method, please use `+ sharedInstance` method"))); + (instancetype)new __attribute__((unavailable("can not use `+ new` method, please use `+ sharedInstance` method"))); diff --git a/STMobSDK/libSuntengMobileAdsSDK.a b/STMobSDK/libSuntengMobileAdsSDK.a index faff467..85d8e88 100644 Binary files a/STMobSDK/libSuntengMobileAdsSDK.a and b/STMobSDK/libSuntengMobileAdsSDK.a differ diff --git a/STMobSDKSample/STMobSDKSample.xcodeproj/project.pbxproj b/STMobSDKSample/STMobSDKSample.xcodeproj/project.pbxproj old mode 100644 new mode 100755 index d39aafd..b01a27d --- a/STMobSDKSample/STMobSDKSample.xcodeproj/project.pbxproj +++ b/STMobSDKSample/STMobSDKSample.xcodeproj/project.pbxproj @@ -21,8 +21,8 @@ C59E8F7B1CCA1A4900E4F152 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C59E8F7A1CCA1A4900E4F152 /* Foundation.framework */; }; C59E8F7D1CCA1A4F00E4F152 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C59E8F7C1CCA1A4F00E4F152 /* SystemConfiguration.framework */; }; C59E8F7F1CCA1A5500E4F152 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C59E8F7E1CCA1A5500E4F152 /* UIKit.framework */; }; + D805BC491DD2CD8000FD5DEE /* libSuntengMobileAdsSDK.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D805BC431DD2CD8000FD5DEE /* libSuntengMobileAdsSDK.a */; }; D86FAF3D1D17E8D7003432D8 /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D86FAF3C1D17E8D7003432D8 /* StoreKit.framework */; }; - D86FAF4D1D17EB29003432D8 /* libSuntengMobileAdsSDK.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D86FAF481D17EB29003432D8 /* libSuntengMobileAdsSDK.a */; }; D86FAF5C1D17F379003432D8 /* LaunchImage.png in Resources */ = {isa = PBXBuildFile; fileRef = D86FAF531D17F379003432D8 /* LaunchImage.png */; }; D86FAF5D1D17F379003432D8 /* LaunchImage4.7@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D86FAF541D17F379003432D8 /* LaunchImage4.7@2x.png */; }; D86FAF5E1D17F379003432D8 /* LaunchImage4@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D86FAF551D17F379003432D8 /* LaunchImage4@2x.png */; }; @@ -37,6 +37,7 @@ /* Begin PBXFileReference section */ 3366FC7F1D129E1D00AD792C /* STMBannerAdViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = STMBannerAdViewController.h; sourceTree = ""; }; 3366FC801D129E1D00AD792C /* STMBannerAdViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = STMBannerAdViewController.m; sourceTree = ""; }; + 33D098721DD1D885005D78AA /* PrefixHeader.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrefixHeader.pch; sourceTree = ""; }; C59E8F501CCA165200E4F152 /* STMobSDKSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = STMobSDKSample.app; sourceTree = BUILT_PRODUCTS_DIR; }; C59E8F541CCA165200E4F152 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; C59E8F561CCA165200E4F152 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; @@ -54,12 +55,13 @@ C59E8F7A1CCA1A4900E4F152 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; C59E8F7C1CCA1A4F00E4F152 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; C59E8F7E1CCA1A5500E4F152 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + D805BC431DD2CD8000FD5DEE /* libSuntengMobileAdsSDK.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libSuntengMobileAdsSDK.a; sourceTree = ""; }; + D805BC441DD2CD8000FD5DEE /* STMBannerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = STMBannerView.h; sourceTree = ""; }; + D805BC451DD2CD8000FD5DEE /* STMConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = STMConstants.h; sourceTree = ""; }; + D805BC461DD2CD8000FD5DEE /* STMInterstitialAdController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = STMInterstitialAdController.h; sourceTree = ""; }; + D805BC471DD2CD8000FD5DEE /* STMSplashAd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = STMSplashAd.h; sourceTree = ""; }; + D805BC481DD2CD8000FD5DEE /* SuntengMobileAdsSDK.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SuntengMobileAdsSDK.h; sourceTree = ""; }; D86FAF3C1D17E8D7003432D8 /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; }; - D86FAF481D17EB29003432D8 /* libSuntengMobileAdsSDK.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libSuntengMobileAdsSDK.a; sourceTree = ""; }; - D86FAF491D17EB29003432D8 /* STMBannerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = STMBannerView.h; sourceTree = ""; }; - D86FAF4A1D17EB29003432D8 /* STMInterstitialAdController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = STMInterstitialAdController.h; sourceTree = ""; }; - D86FAF4B1D17EB29003432D8 /* STMSplashAd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = STMSplashAd.h; sourceTree = ""; }; - D86FAF4C1D17EB29003432D8 /* SuntengMobileAdsSDK.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SuntengMobileAdsSDK.h; sourceTree = ""; }; D86FAF531D17F379003432D8 /* LaunchImage.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = LaunchImage.png; sourceTree = ""; }; D86FAF541D17F379003432D8 /* LaunchImage4.7@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "LaunchImage4.7@2x.png"; sourceTree = ""; }; D86FAF551D17F379003432D8 /* LaunchImage4@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "LaunchImage4@2x.png"; sourceTree = ""; }; @@ -76,7 +78,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - D86FAF4D1D17EB29003432D8 /* libSuntengMobileAdsSDK.a in Frameworks */, + D805BC491DD2CD8000FD5DEE /* libSuntengMobileAdsSDK.a in Frameworks */, D86FAF3D1D17E8D7003432D8 /* StoreKit.framework in Frameworks */, C59E8F7F1CCA1A5500E4F152 /* UIKit.framework in Frameworks */, C59E8F7D1CCA1A4F00E4F152 /* SystemConfiguration.framework in Frameworks */, @@ -112,8 +114,8 @@ C59E8F521CCA165200E4F152 /* STMobSDKSample */ = { isa = PBXGroup; children = ( + D805BC421DD2CD8000FD5DEE /* STMobSDK */, D86FAF521D17F379003432D8 /* LaunchImages */, - D86FAF471D17EB29003432D8 /* STMobSDK */, C59E8F561CCA165200E4F152 /* AppDelegate.h */, C59E8F571CCA165200E4F152 /* AppDelegate.m */, C59E8F591CCA165300E4F152 /* STMInterstitialAdViewController.h */, @@ -132,6 +134,7 @@ isa = PBXGroup; children = ( C59E8F541CCA165200E4F152 /* main.m */, + 33D098721DD1D885005D78AA /* PrefixHeader.pch */, ); name = "Supporting Files"; sourceTree = ""; @@ -152,16 +155,18 @@ name = Frameworks; sourceTree = ""; }; - D86FAF471D17EB29003432D8 /* STMobSDK */ = { + D805BC421DD2CD8000FD5DEE /* STMobSDK */ = { isa = PBXGroup; children = ( - D86FAF481D17EB29003432D8 /* libSuntengMobileAdsSDK.a */, - D86FAF491D17EB29003432D8 /* STMBannerView.h */, - D86FAF4A1D17EB29003432D8 /* STMInterstitialAdController.h */, - D86FAF4B1D17EB29003432D8 /* STMSplashAd.h */, - D86FAF4C1D17EB29003432D8 /* SuntengMobileAdsSDK.h */, + D805BC431DD2CD8000FD5DEE /* libSuntengMobileAdsSDK.a */, + D805BC441DD2CD8000FD5DEE /* STMBannerView.h */, + D805BC451DD2CD8000FD5DEE /* STMConstants.h */, + D805BC461DD2CD8000FD5DEE /* STMInterstitialAdController.h */, + D805BC471DD2CD8000FD5DEE /* STMSplashAd.h */, + D805BC481DD2CD8000FD5DEE /* SuntengMobileAdsSDK.h */, ); - path = STMobSDK; + name = STMobSDK; + path = ../../STMobSDK; sourceTree = ""; }; D86FAF521D17F379003432D8 /* LaunchImages */ = { @@ -211,6 +216,7 @@ TargetAttributes = { C59E8F4F1CCA165200E4F152 = { CreatedOnToolsVersion = 7.2; + DevelopmentTeam = Q4J4V8H839; }; }; }; @@ -305,6 +311,8 @@ GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SRCROOT)/STMobSDKSample/PrefixHeader.pch"; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", @@ -347,6 +355,8 @@ ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SRCROOT)/STMobSDKSample/PrefixHeader.pch"; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; @@ -367,14 +377,17 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; CODE_SIGN_IDENTITY = "iPhone Developer"; + DEVELOPMENT_TEAM = Q4J4V8H839; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SRCROOT)/STMobSDKSample/PrefixHeader.pch"; INFOPLIST_FILE = STMobSDKSample/Info.plist; + INFOPLIST_PREFIX_HEADER = ""; + INFOPLIST_PREPROCESS = NO; IPHONEOS_DEPLOYMENT_TARGET = 6.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", - "$(PROJECT_DIR)/STMobSDKSample/SuntengMobileAdsSDK", - "$(PROJECT_DIR)/STMobSDKSample", - "$(PROJECT_DIR)/STMobSDKSample/STMobSDK", + "$(PROJECT_DIR)/../STMobSDK", ); OTHER_LDFLAGS = "-ObjC"; PRODUCT_BUNDLE_IDENTIFIER = com.sunteng.STMobSDKSample; @@ -389,14 +402,17 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; CODE_SIGN_IDENTITY = "iPhone Distribution"; + DEVELOPMENT_TEAM = Q4J4V8H839; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SRCROOT)/STMobSDKSample/PrefixHeader.pch"; INFOPLIST_FILE = STMobSDKSample/Info.plist; + INFOPLIST_PREFIX_HEADER = ""; + INFOPLIST_PREPROCESS = NO; IPHONEOS_DEPLOYMENT_TARGET = 6.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", - "$(PROJECT_DIR)/STMobSDKSample/SuntengMobileAdsSDK", - "$(PROJECT_DIR)/STMobSDKSample", - "$(PROJECT_DIR)/STMobSDKSample/STMobSDK", + "$(PROJECT_DIR)/../STMobSDK", ); OTHER_LDFLAGS = "-ObjC"; PRODUCT_BUNDLE_IDENTIFIER = com.sunteng.STMobSDKSample; diff --git a/STMobSDKSample/STMobSDKSample.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/STMobSDKSample/STMobSDKSample.xcodeproj/project.xcworkspace/contents.xcworkspacedata old mode 100644 new mode 100755 diff --git a/STMobSDKSample/STMobSDKSample.xcodeproj/project.xcworkspace/xcuserdata/east.xcuserdatad/UserInterfaceState.xcuserstate b/STMobSDKSample/STMobSDKSample.xcodeproj/project.xcworkspace/xcuserdata/east.xcuserdatad/UserInterfaceState.xcuserstate old mode 100644 new mode 100755 diff --git a/STMobSDKSample/STMobSDKSample.xcodeproj/xcuserdata/east.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/STMobSDKSample/STMobSDKSample.xcodeproj/xcuserdata/east.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist old mode 100644 new mode 100755 diff --git a/STMobSDKSample/STMobSDKSample.xcodeproj/xcuserdata/east.xcuserdatad/xcschemes/STMobSDKSample.xcscheme b/STMobSDKSample/STMobSDKSample.xcodeproj/xcuserdata/east.xcuserdatad/xcschemes/STMobSDKSample.xcscheme old mode 100644 new mode 100755 diff --git a/STMobSDKSample/STMobSDKSample.xcodeproj/xcuserdata/east.xcuserdatad/xcschemes/xcschememanagement.plist b/STMobSDKSample/STMobSDKSample.xcodeproj/xcuserdata/east.xcuserdatad/xcschemes/xcschememanagement.plist old mode 100644 new mode 100755 diff --git a/STMobSDKSample/STMobSDKSample/AppDelegate.h b/STMobSDKSample/STMobSDKSample/AppDelegate.h old mode 100644 new mode 100755 diff --git a/STMobSDKSample/STMobSDKSample/AppDelegate.m b/STMobSDKSample/STMobSDKSample/AppDelegate.m old mode 100644 new mode 100755 index 3066939..f56c26b --- a/STMobSDKSample/STMobSDKSample/AppDelegate.m +++ b/STMobSDKSample/STMobSDKSample/AppDelegate.m @@ -20,6 +20,7 @@ @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. + application.statusBarHidden = YES; UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; UIViewController *vc = [storyboard instantiateInitialViewController]; self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; @@ -27,9 +28,10 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( [self.window makeKeyAndVisible]; // splash SDK - self.splashAd = [STMSplashAd splashAdWithPublishedId:@"1" - appId:@"2" - placementId:@"34"]; + self.splashAd = [STMSplashAd splashAdWithPublisherID:PUBLISHERID + appID:APPID + placementID:@"34" + appKey:APPKEY]; self.splashAd.delegate = self; // 设置一个跟启动屏幕一致的图片作为背景图 @@ -52,7 +54,6 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( } } UIColor *backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:launchImageName]]; - [self.splashAd presentInWindow:self.window backgroundColor:backgroundColor]; return YES; @@ -78,6 +79,7 @@ - (void)splashDidTap:(STMSplashAd *)splash { // 当开屏广告被关闭后,回调该方法 - (void)splashDidDismiss:(STMSplashAd *)splash { NSLog(@"%s", __func__); + [UIApplication sharedApplication].statusBarHidden = NO; } @end diff --git a/STMobSDKSample/STMobSDKSample/Assets.xcassets/AppIcon.appiconset/Contents.json b/STMobSDKSample/STMobSDKSample/Assets.xcassets/AppIcon.appiconset/Contents.json old mode 100644 new mode 100755 index eeea76c..1d060ed --- a/STMobSDKSample/STMobSDKSample/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/STMobSDKSample/STMobSDKSample/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -1,5 +1,15 @@ { "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, { "idiom" : "iphone", "size" : "29x29", @@ -30,6 +40,16 @@ "size" : "60x60", "scale" : "3x" }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, { "idiom" : "ipad", "size" : "29x29", diff --git a/STMobSDKSample/STMobSDKSample/Assets.xcassets/Contents.json b/STMobSDKSample/STMobSDKSample/Assets.xcassets/Contents.json old mode 100644 new mode 100755 diff --git a/STMobSDKSample/STMobSDKSample/Assets.xcassets/LaunchImage.launchimage/Contents.json b/STMobSDKSample/STMobSDKSample/Assets.xcassets/LaunchImage.launchimage/Contents.json old mode 100644 new mode 100755 diff --git a/STMobSDKSample/STMobSDKSample/Assets.xcassets/LaunchImage.launchimage/LaunchImage.png b/STMobSDKSample/STMobSDKSample/Assets.xcassets/LaunchImage.launchimage/LaunchImage.png old mode 100644 new mode 100755 diff --git a/STMobSDKSample/STMobSDKSample/Assets.xcassets/LaunchImage.launchimage/LaunchImage4.7@2x.png b/STMobSDKSample/STMobSDKSample/Assets.xcassets/LaunchImage.launchimage/LaunchImage4.7@2x.png old mode 100644 new mode 100755 diff --git a/STMobSDKSample/STMobSDKSample/Assets.xcassets/LaunchImage.launchimage/LaunchImage4@2x.png b/STMobSDKSample/STMobSDKSample/Assets.xcassets/LaunchImage.launchimage/LaunchImage4@2x.png old mode 100644 new mode 100755 diff --git a/STMobSDKSample/STMobSDKSample/Assets.xcassets/LaunchImage.launchimage/LaunchImage5.5@3x.png b/STMobSDKSample/STMobSDKSample/Assets.xcassets/LaunchImage.launchimage/LaunchImage5.5@3x.png old mode 100644 new mode 100755 diff --git a/STMobSDKSample/STMobSDKSample/Assets.xcassets/LaunchImage.launchimage/LaunchImage@2x.png b/STMobSDKSample/STMobSDKSample/Assets.xcassets/LaunchImage.launchimage/LaunchImage@2x.png old mode 100644 new mode 100755 diff --git a/STMobSDKSample/STMobSDKSample/Assets.xcassets/LaunchImage.launchimage/LaunchImage_Landscape.png b/STMobSDKSample/STMobSDKSample/Assets.xcassets/LaunchImage.launchimage/LaunchImage_Landscape.png old mode 100644 new mode 100755 diff --git a/STMobSDKSample/STMobSDKSample/Assets.xcassets/LaunchImage.launchimage/LaunchImage_Landscape@2x.png b/STMobSDKSample/STMobSDKSample/Assets.xcassets/LaunchImage.launchimage/LaunchImage_Landscape@2x.png old mode 100644 new mode 100755 diff --git a/STMobSDKSample/STMobSDKSample/Assets.xcassets/LaunchImage.launchimage/LaunchImage_Portrait.png b/STMobSDKSample/STMobSDKSample/Assets.xcassets/LaunchImage.launchimage/LaunchImage_Portrait.png old mode 100644 new mode 100755 diff --git a/STMobSDKSample/STMobSDKSample/Assets.xcassets/LaunchImage.launchimage/LaunchImage_Portrait@2x.png b/STMobSDKSample/STMobSDKSample/Assets.xcassets/LaunchImage.launchimage/LaunchImage_Portrait@2x.png old mode 100644 new mode 100755 diff --git a/STMobSDKSample/STMobSDKSample/Base.lproj/Main.storyboard b/STMobSDKSample/STMobSDKSample/Base.lproj/Main.storyboard old mode 100644 new mode 100755 index fd536a4..4b3fe14 --- a/STMobSDKSample/STMobSDKSample/Base.lproj/Main.storyboard +++ b/STMobSDKSample/STMobSDKSample/Base.lproj/Main.storyboard @@ -1,7 +1,8 @@ - + + @@ -10,9 +11,9 @@ - + - + @@ -95,20 +96,20 @@ - + - - - + + + - - - + @@ -159,18 +160,18 @@ - + - - + + - + @@ -183,7 +184,12 @@ - + + + + + + diff --git a/STMobSDKSample/STMobSDKSample/Info.plist b/STMobSDKSample/STMobSDKSample/Info.plist old mode 100644 new mode 100755 index 23f3161..cfabb11 --- a/STMobSDKSample/STMobSDKSample/Info.plist +++ b/STMobSDKSample/STMobSDKSample/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.1.0 + 2.0.3 CFBundleSignature ???? CFBundleVersion @@ -33,6 +33,8 @@ armv7 + UIStatusBarHidden + UISupportedInterfaceOrientations UIInterfaceOrientationPortrait @@ -44,5 +46,7 @@ UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight + UIViewControllerBasedStatusBarAppearance + diff --git a/STMobSDKSample/STMobSDKSample/LaunchImages/LaunchImage.png b/STMobSDKSample/STMobSDKSample/LaunchImages/LaunchImage.png old mode 100644 new mode 100755 diff --git a/STMobSDKSample/STMobSDKSample/LaunchImages/LaunchImage4.7@2x.png b/STMobSDKSample/STMobSDKSample/LaunchImages/LaunchImage4.7@2x.png old mode 100644 new mode 100755 diff --git a/STMobSDKSample/STMobSDKSample/LaunchImages/LaunchImage4@2x.png b/STMobSDKSample/STMobSDKSample/LaunchImages/LaunchImage4@2x.png old mode 100644 new mode 100755 diff --git a/STMobSDKSample/STMobSDKSample/LaunchImages/LaunchImage5.5@3x.png b/STMobSDKSample/STMobSDKSample/LaunchImages/LaunchImage5.5@3x.png old mode 100644 new mode 100755 diff --git a/STMobSDKSample/STMobSDKSample/LaunchImages/LaunchImage@2x.png b/STMobSDKSample/STMobSDKSample/LaunchImages/LaunchImage@2x.png old mode 100644 new mode 100755 diff --git a/STMobSDKSample/STMobSDKSample/LaunchImages/LaunchImage_Landscape.png b/STMobSDKSample/STMobSDKSample/LaunchImages/LaunchImage_Landscape.png old mode 100644 new mode 100755 diff --git a/STMobSDKSample/STMobSDKSample/LaunchImages/LaunchImage_Landscape@2x.png b/STMobSDKSample/STMobSDKSample/LaunchImages/LaunchImage_Landscape@2x.png old mode 100644 new mode 100755 diff --git a/STMobSDKSample/STMobSDKSample/LaunchImages/LaunchImage_Portrait.png b/STMobSDKSample/STMobSDKSample/LaunchImages/LaunchImage_Portrait.png old mode 100644 new mode 100755 diff --git a/STMobSDKSample/STMobSDKSample/LaunchImages/LaunchImage_Portrait@2x.png b/STMobSDKSample/STMobSDKSample/LaunchImages/LaunchImage_Portrait@2x.png old mode 100644 new mode 100755 diff --git a/STMobSDKSample/STMobSDKSample/PrefixHeader.pch b/STMobSDKSample/STMobSDKSample/PrefixHeader.pch new file mode 100644 index 0000000..4f2e2da --- /dev/null +++ b/STMobSDKSample/STMobSDKSample/PrefixHeader.pch @@ -0,0 +1,20 @@ +// +// PrefixHeader.pch +// STMobSDKSample +// +// Created by samingzhong on 2016/11/8. +// Copyright © 2016年 sunteng. All rights reserved. +// + +#ifndef PrefixHeader_pch +#define PrefixHeader_pch + +// Include any system framework and library headers here that should be included in all compilation units. +// You will also need to set the Prefix Header build setting of one or more of your targets to reference this file. + +//appID、publisherID、placementID、appKey setting +#define PUBLISHERID @"2" +#define APPID @"36" +#define APPKEY @"Ac7Kd3lJ^KQX9Hjkn_Z(UO9jqViFh*q1" + +#endif /* PrefixHeader_pch */ diff --git a/STMobSDKSample/STMobSDKSample/STMBannerAdViewController.h b/STMobSDKSample/STMobSDKSample/STMBannerAdViewController.h old mode 100644 new mode 100755 diff --git a/STMobSDKSample/STMobSDKSample/STMBannerAdViewController.m b/STMobSDKSample/STMobSDKSample/STMBannerAdViewController.m old mode 100644 new mode 100755 index cf9b1b8..97505e5 --- a/STMobSDKSample/STMobSDKSample/STMBannerAdViewController.m +++ b/STMobSDKSample/STMobSDKSample/STMBannerAdViewController.m @@ -21,10 +21,12 @@ @implementation STMBannerAdViewController - (void)viewDidLoad { [super viewDidLoad]; - self.bannerAdView = [[STMBannerView alloc]initWithPublishedId:@"2" - appId:@"23" - placementId:@"35" - frame:self.adViewContainer.bounds]; + self.bannerAdView = [[STMBannerView alloc] initWithPublisherID:PUBLISHERID + appID:APPID + placementID:@"35" + appKey:APPKEY + frame:self.adViewContainer.bounds]; + self.bannerAdView.delegate = self; [self.adViewContainer addSubview:self.bannerAdView]; [self.bannerAdView loadAd]; diff --git a/STMobSDKSample/STMobSDKSample/STMInterstitialAdViewController.h b/STMobSDKSample/STMobSDKSample/STMInterstitialAdViewController.h old mode 100644 new mode 100755 diff --git a/STMobSDKSample/STMobSDKSample/STMInterstitialAdViewController.m b/STMobSDKSample/STMobSDKSample/STMInterstitialAdViewController.m old mode 100644 new mode 100755 index eda1a34..b50cd3d --- a/STMobSDKSample/STMobSDKSample/STMInterstitialAdViewController.m +++ b/STMobSDKSample/STMobSDKSample/STMInterstitialAdViewController.m @@ -41,9 +41,10 @@ - (IBAction)loadAd:(UIButton *)sender { self.isLoading = YES; if (!self.interstitialAdController) { - self.interstitialAdController = [STMInterstitialAdController interstitialAdControllerWithPublishedId:@"2" - appId:@"23" - placementId:@"36"]; + self.interstitialAdController = [STMInterstitialAdController interstitialAdControllerWithPublisherID:PUBLISHERID + appID:APPID + placementID:@"36" + appKey:APPKEY]; self.interstitialAdController.delegate = self; } diff --git a/STMobSDKSample/STMobSDKSample/STMobSDK/STMBannerView.h b/STMobSDKSample/STMobSDKSample/STMobSDK/STMBannerView.h deleted file mode 100644 index f44ded3..0000000 --- a/STMobSDKSample/STMobSDKSample/STMobSDK/STMBannerView.h +++ /dev/null @@ -1,112 +0,0 @@ -// -// STMBannerView.h -// SuntengMobileAdsSDK -// -// Created by Joe. -// Copyright © 2016年 Sunteng Information Technology Co., Ltd. All rights reserved. -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol STMBannerViewDelegate; - -///-------------------- -/// @name STMBannerView -///-------------------- - -@interface STMBannerView : UIView - -/** - * Create and return a `STMBannerView` instance. - * - * @param publishedId The published id. - * @param appId The app id. - * @param placementId The placement id. - * @param frame The banner view frame. - * - * @return A `STMInterstitialAdController` instance. - */ -- (nullable instancetype)initWithPublishedId:(NSString *)publishedId - appId:(NSString *)appId - placementId:(NSString *)placementId - frame:(CGRect)frame; - -- (instancetype)init __attribute__((unavailable("can not use `- init` method, please use `- initWithPublishedId:appId:placementId:frame:` method"))); -+ (instancetype)new __attribute__((unavailable("can not use `+ new` method, please use `- initWithPublishedId:appId:placementId:frame:` method"))); - -/** - * The placement Id. - */ -@property (nonatomic, copy, readonly) NSString *adUnitID; - -/** - * The `STMBannerView` delegate. - */ -@property (nullable, nonatomic, weak) id delegate; - -/** - * Check is ad loaded and ready to show. - */ -@property (nonatomic, assign, readonly, getter=isLoaded) BOOL loaded; - -/** - * Load ad. - */ -- (void)loadAd; - -/** - * Manual stop banner ad automatically refresh. - * Use this method when banner is not display in the window. - * For example, stop refresh ad when you push to another view controller. - */ -- (void)stopAutomaticallyRefreshingAd; - -/** - * Resume banner ad automatically refresh. - */ -- (void)startAutomaticallyRefreshingAd; - -@end - -///---------------------------- -/// @name STMBannerViewDelegate -///---------------------------- - -@protocol STMBannerViewDelegate - -@optional - -/** - * The banner ad loaded. - * - * @param bannerView The `bannerView` instance. - */ -- (void)bannerViewDidLoadAd:(STMBannerView *)bannerView; - -/** - * The banner ad load failed. - * - * @param bannerView The `bannerView` instance. - * @param error The error information of `bannerView` load fail. - */ -- (void)bannerView:(STMBannerView *)bannerView didFailToLoadAdWithError:(NSError *)error; - -/** - * The banner ad tapped. - * - * @param bannerView The `bannerView` instance. - */ -- (void)bannerViewDidTap:(STMBannerView *)bannerView; - -/** - * The banner ad closed. - * - * @param bannerView The `bannerView` instance. - */ -- (void)bannerViewDidDismiss:(STMBannerView *)bannerView; - -@end - -NS_ASSUME_NONNULL_END diff --git a/STMobSDKSample/STMobSDKSample/STMobSDK/STMInterstitialAdController.h b/STMobSDKSample/STMobSDKSample/STMobSDK/STMInterstitialAdController.h deleted file mode 100644 index f49c708..0000000 --- a/STMobSDKSample/STMobSDKSample/STMobSDK/STMInterstitialAdController.h +++ /dev/null @@ -1,111 +0,0 @@ -// -// STMInterstitialAdController.h -// SuntengMobileAdsSDK -// -// Created by Joe. -// Copyright © 2016年 Sunteng Information Technology Co., Ltd. All rights reserved. -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol STMInterstitialAdControllerDelegate; - -///---------------------------------- -/// @name STMInterstitialAdController -///---------------------------------- - -@interface STMInterstitialAdController : UIViewController - -/** - * Create and return a `STMInterstitialAdController` instance. - * - * @param publishedId The published id. - * @param appId The app id. - * @param placementId The placement id. - * - * @return A `STMInterstitialAdController` instance. - */ -+ (nullable instancetype)interstitialAdControllerWithPublishedId:(NSString *)publishedId - appId:(NSString *)appId - placementId:(NSString *)placementId; - -- (instancetype)init __attribute__((unavailable("can not use `- init` method, please use `+ interstitialAdControllerWithPublishedId:appId:placementId:` method"))); -+ (instancetype)new __attribute__((unavailable("can not use `+ new` method, please use `+ interstitialAdControllerWithPublishedId:appId:placementId:` method"))); - -/** - * The placement Id. - */ -@property (nonatomic, copy, readonly) NSString *adUnitID; - -/** - * The `STMInterstitialAdController` delegate. - */ -@property (nullable, nonatomic, weak) id 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 - -@optional - -/** - * The interstitial ad loaded. - * - * @param interstitial The `STMInterstitialAdController` instance. - */ -- (void)interstitialDidLoad:(STMInterstitialAdController *)interstitial; - -/** - * The interstitial ad load failed. - * - * @param interstitial The `STMInterstitialAdController` instance. - */ -- (void)interstitialDidLoadFail:(STMInterstitialAdController *)interstitial; - -/** - * The interstitial ad presented. - * - * @param interstitial The `STMInterstitialAdController` instance. - */ -- (void)interstitialDidPresent:(STMInterstitialAdController *)interstitial; - -/** - * The interstitial ad tapped. - * - * @param interstitial The `STMInterstitialAdController` instance. - */ -- (void)interstitialDidTap:(STMInterstitialAdController *)interstitial; - -/** - * The interstitial ad closed. - * - * @param interstitial The `STMInterstitialAdController` instance. - */ -- (void)interstitialDidDismiss:(STMInterstitialAdController *)interstitial; - -@end - -NS_ASSUME_NONNULL_END diff --git a/STMobSDKSample/STMobSDKSample/STMobSDK/STMSplashAd.h b/STMobSDKSample/STMobSDKSample/STMobSDK/STMSplashAd.h deleted file mode 100644 index 5f0aaa4..0000000 --- a/STMobSDKSample/STMobSDKSample/STMobSDK/STMSplashAd.h +++ /dev/null @@ -1,108 +0,0 @@ -// -// STMSplashAd.h -// SuntengMobileAdsSDK -// -// Created by Joe. -// Copyright © 2016年 Sunteng Information Technology Co., Ltd. All rights reserved. -// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol STMSplashAdDelegate; - -///------------------ -/// @name STMSplashAd -///------------------ - -@interface STMSplashAd : NSObject - -/** - * Create and return a `STMSplashAd` instance. - * - * @param publishedId The published id. - * @param appId The app id. - * @param placementId The placement id. - * - * @return A `STMSplashAd` instance. - */ -+ (nullable instancetype)splashAdWithPublishedId:(NSString *)publishedId - appId:(NSString *)appId - placementId:(NSString *)placementId; - -- (instancetype)init __attribute__((unavailable("can not use `- init` method, please use `+ initWithPublishedId:appId:placementId:` method"))); -+ (instancetype)new __attribute__((unavailable("can not use `+ new` method, please use `+ initWithPublishedId:appId:placementId:` method"))); - -/** - * The placement Id - */ -@property (nonatomic, copy, readonly) NSString *adUnitID; - -/** - * The `STMSplashAd` delegate. - */ -@property (nullable, nonatomic, weak) id delegate; - -/** - * Check is ad loaded and ready to show. - */ -@property (nonatomic, assign, readonly, getter=isLoaded) BOOL loaded; - -/** - * Present ad in the window. - * - * @param window Ad present in this window. - * @param backgroundColor Set a launch image for background color. - */ -- (void)presentInWindow:(UIWindow *)window backgroundColor:(nullable UIColor *)backgroundColor; - -/** - * Set realtime splash timeout interval, default is 2.0s. - * - * @param interval Timeout interval. - */ -- (void)setRealtimeSplashTimeoutInterval:(CGFloat)interval; - -@end - -///-------------------------- -/// @name STMSplashAdDelegate -///-------------------------- - -@protocol STMSplashAdDelegate - -@optional - -/** - * The splash ad presented. - * - * @param splash The `STMSplashAd` instance. - */ -- (void)splashDidPresent:(STMSplashAd *)splash; - -/** - * The splash ad fail to present. - * - * @param splash The `STMSplashAd` instance. - */ -- (void)splashlFailPresent:(STMSplashAd *)splash; - -/** - * The splash ad tapped. - * - * @param splash The `STMSplashAd` instance. - */ -- (void)splashDidTap:(STMSplashAd *)splash; - -/** - * The splash ad closed. - * - * @param splash The `STMSplashAd` instance. - */ -- (void)splashDidDismiss:(STMSplashAd *)splash; - -@end - -NS_ASSUME_NONNULL_END diff --git a/STMobSDKSample/STMobSDKSample/STMobSDK/SuntengMobileAdsSDK.h b/STMobSDKSample/STMobSDKSample/STMobSDK/SuntengMobileAdsSDK.h deleted file mode 100644 index d38bee5..0000000 --- a/STMobSDKSample/STMobSDKSample/STMobSDK/SuntengMobileAdsSDK.h +++ /dev/null @@ -1,35 +0,0 @@ -// -// SuntengMobileAdsSDK.h -// SuntengMobileAdsSDK -// -// Created by Joe. -// Copyright © 2016年 Sunteng Information Technology Co., Ltd. All rights reserved. -// - -#import -#import "STMSplashAd.h" -#import "STMBannerView.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; - -- (instancetype)init __attribute__((unavailable("can not use `- init` method, please use `+ sharedInstance` method"))); -+ (instancetype)new __attribute__((unavailable("can not use `+ new` method, please use `+ sharedInstance` method"))); - -@end - -NS_ASSUME_NONNULL_END diff --git a/STMobSDKSample/STMobSDKSample/STMobSDK/libSuntengMobileAdsSDK.a b/STMobSDKSample/STMobSDKSample/STMobSDK/libSuntengMobileAdsSDK.a deleted file mode 100644 index faff467..0000000 Binary files a/STMobSDKSample/STMobSDKSample/STMobSDK/libSuntengMobileAdsSDK.a and /dev/null differ diff --git a/STMobSDKSample/STMobSDKSample/main.m b/STMobSDKSample/STMobSDKSample/main.m old mode 100644 new mode 100755