|
| 1 | +# OneWaySDK iOS Integration Guide |
| 2 | +|Version | Update | Date | |
| 3 | +| :--- | :--- | :--- | |
| 4 | +| 1.2.1 | 1.support Bitcode 2.support Xcode 7 3.Modify some parameters| 2017.03.09 | |
| 5 | +| 1.2.0 | Fix some Bugs | 2017.01.09 | |
| 6 | + |
| 7 | +When you read this document, we assume that you already have a basis of iOS app development experience, and to understand the related basic concepts. |
| 8 | + |
| 9 | +## Integration SDK |
| 10 | +**1.You must be set parameters ``` –all_load ``` in options “Other linker flags”.** |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | +```objective-c |
| 15 | +// Or you can use following parameters if there is any conflict |
| 16 | +-force_load $(SRCROOT)/OneWaySDK/OneWaySDK.a //According to your SDK path |
| 17 | +``` |
| 18 | + |
| 19 | +**2. Import OneWaySDK.h and Implement OneWaySDKDelegate in AppDelegate.h :** |
| 20 | + |
| 21 | +``` objective-c |
| 22 | +#import "OneWaySDK.h" |
| 23 | +@interface AppDelegate : UIResponder <UIApplicationDelegate,OneWaySDKDelegate> |
| 24 | +``` |
| 25 | +<Br>**3.Add the following methods to implement the required delegates on the view controller class :** |
| 26 | +
|
| 27 | +``` objective-c |
| 28 | +- (void)oneWaySDKReady:(NSString *)placementId; |
| 29 | +- (void)oneWaySDKDidError:(OneWaySDKError)error withMessage:(NSString *)message; |
| 30 | +- (void)oneWaySDKDidStart:(NSString *)placementId; |
| 31 | +- (void)oneWaySDKDidFinish:(NSString *)placementId withFinishState:(OneWaySDKFinishState)state; |
| 32 | +``` |
| 33 | + |
| 34 | +<Br>**4.The following code will initialize SDK :** |
| 35 | + |
| 36 | +``` objective-c |
| 37 | +- (BOOL)application:(UIApplication *)application |
| 38 | + didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ |
| 39 | + |
| 40 | +[OneWaySDK initialize: @"Your PublishId" delegate:self]; |
| 41 | + //when you create a applications in our platform, you will get a publish ID. |
| 42 | + |
| 43 | +return YES; |
| 44 | +} |
| 45 | +``` |
| 46 | + |
| 47 | + |
| 48 | +<Br>**5.The following code will show an ad :** |
| 49 | + |
| 50 | +Show default placement : |
| 51 | + |
| 52 | +``` objective-c |
| 53 | +if ([OneWaySDK isReady]) { |
| 54 | + [OneWaySDK show:self]; |
| 55 | + //You can set default PlacementID in our developer platform. |
| 56 | +} |
| 57 | +``` |
| 58 | + |
0 commit comments