m |
|
(23 intermediate revisions not shown.) |
Line 1: |
Line 1: |
| == OS Support == | | == OS Support == |
| | | |
- | The ePrize Mobile SDK is built for iOS apps targeting <b>iOS 5 and higher. </b> | + | The [[Mobile_SDK|HelloWorld Mobile SDK]] is built for iOS apps targeting <b>iOS 6 and higher. </b> |
| | | |
| + | == Version & Release Notes == |
| | | |
- | == Getting Started ==
| + | <b>SDK Version:</b> 2.1 |
| | | |
- | The ePrize Mobile SDK is designed to be an easy and practical way to retrieve a list of active promotions your organization is running with ePrize, Inc. Once you retrieve a list of active promotions, you can use the SDK to launch a given promotion using an instance of the SDK's built-in web view controller, where the specified promotion will be loaded into a customizable web view and presented to the user - all while remaining in your mobile application.
| + | <b>Release Notes:</b> |
| | | |
- | <div style="margin: 20px 0px; padding:20px; background:#ffd; border:1px solid #ddc;"><i><b>Please note:</b> Using this SDK requires a valid client key provided by ePrize. If you do not have a client key, please contact your account team or Producer.</i></div>
| + | * Performance and bug fixes |
| | | |
- | === Key Concepts === | + | <div style="margin: 20px 0px; padding:20px; background:#ffd; border:1px solid #ddc;"><i><b>Note on naming:</b> You will notice that the SDK uses the historical company name “ePrize” in the framework name, and “EPZ” for the class namespace. Future releases of the SDK may include updates to these names and namespaces to reflect the new company name, HelloWorld, which was introduced in 2014. </i></div> |
| | | |
- | <b>Shared Library</b><br />
| + | == Key Concepts == |
- | This SDK has a class named [[#Class_Documentation:_EPZPromoLibrary|EPZPromoLibrary]], which is a Singleton class that is the workhorse of the SDK. Since it is a Singleton, you will not create instances of it, but rather, will simply reference the [[#sharedLibrary|sharedLibrary]] property. As you will see in the code samples, this results in some extra length being added to the lines of code. However, since it is a Singleton, it is shared across your application, so you will never need to create instances of it.
| + | |
| | | |
- | <b>Configuration Keys</b><br />
| + | === Singleton Classes === |
- | This SDK uses a concept of configuration keys to access data and instantiate views. Each active promotion that your organization has with ePrize will have an associated configuration key. When the list of active promotions is retrieved, you will have access to an array of these configuration keys. You will use the keys to get access to specific promotion configurations ([[#Class_Documentation:_EPZPromoConfiguration|EPZPromoConfiguration]]), and to instantiate promo views ([[#Class_Documentation:_EPZPromoWebViewController|EPZPromoWebViewController]]). The array of keys is stored in the [[#Class_Documentation:_EPZPromoLibrary|EPZPromoLibrary]] [[#sharedLibrary|sharedLibrary]] for access anywhere in your application.
| + | The SDK includes a number of Singleton classes which you will not create instances of, but rather, can simply reference the shared Singleton property for each respective class. The Singleton classes/properties used in the SDK include: |
- | <br /> | + | * [[[Mobile_SDK_iOS:_EPZAnalyticsService|EPZAnalyticsService]] [[Mobile_SDK_iOS:_EPZAnalyticsService#sharedService|sharedService]]] |
| + | * [[[Mobile_SDK_iOS:_EPZPromoLibrary|EPZPromoLibrary]] [[Mobile_SDK_iOS:_EPZPromoLibrary#sharedLibrary|sharedLibrary]]] |
| | | |
- | === Step 1: Obtain the EPrizeMobileSDK === | + | === Callback Blocks === |
| + | Version 2.0 of this SDK includes a major shift in the callback logic used. Where version 1.0 used delegates as the primary method of implementing callbacks from the SDK, version 2.0 introduces blocks as the main callback method for the majority of public methods in all Singleton classes. As you will see in the class-specific documentation, there are block arguments for all methods which utilize blocks as the callback methods. This said, there are still instances of delegates and delegate methods, namely in the SDK's built-in view controllers. |
| | | |
- | Please contact your account team or Producer to obtain your copy of the ePrize Mobile SDK.
| + | === Configuration Keys === |
| + | The SDK uses a concept of configuration keys to access data about promotions and instantiate certain views. Each active promotion will have an associated configuration key. When the list of active promotions is retrieved, you will have access to an array of these configuration keys. You will use the keys to get access to specific promotion configurations ([[#Class_Documentation:_EPZPromoConfiguration|EPZPromoConfiguration]]), and to instantiate the SDK's built-in web view controller ([[#Class_Documentation:_EPZPromoWebViewController|EPZPromoWebViewController]]). The array of keys is stored in the [[#Class_Documentation:_EPZPromoLibrary|EPZPromoLibrary]] [[#sharedLibrary|sharedLibrary]] for access anywhere in your application. |
| | | |
- | <i>Please note: It is highly recommended that you save the framework to a specific and static location on your computer (e.g. a location where you save other third-party SDKs and frameworks). This can allow you to better use the framework across multiple projects, if needed.</i> | |
| | | |
- | === Step 2: Include framework into your project === | + | == Getting Started == |
| | | |
- | In your application’s project navigator, click on the Build Phases tab in your project’s target. Under “Link Binary With Libraries”, click the “+” button and select “Add Other” from the dialog box. Navigate to the EPrizeMobileSDK.framework directory you saved from step 1 above, and click “Open”. The EPrizeMobileSDK framework is now included in your project and ready to use.
| + | The SDK is designed to be an easy and practical way to retrieve a list of active promotions your organization is running with HelloWorld, Inc. Once you retrieve a list of active promotions, you can use the SDK to launch a given promotion using an instance of the SDK's built-in web view controller, where the specified promotion will be loaded into a customizable web view and presented to the user - all while remaining in your mobile application. |
| | | |
- | === Step 3: Import framework as necessary === | + | <div style="margin: 20px 0px; padding:20px; background:#ffd; border:1px solid #ddc;"><i><b>Please note:</b> Using this SDK requires a valid client key provided by HelloWorld. If you do not have a client key, please contact your account team or Producer. </i></div> |
| | | |
- | In any class file that needs to utilize the SDK, you will need to import the framework files. You can consult the [[#Class_Documentation:_EPZPromoLibrary|EPrizeMobileSDK Class Documentation]] section below for more information about each of the classes included in the SDK.
| + | === Obtain the EPrizeMobileSDK === |
| | | |
- | == Sample Integration ==
| + | Please contact your account team or Producer to obtain your copy of the SDK. |
| | | |
- | The following section outlines steps to get up and running with the EPrizeMobileSDK in your app. These steps provide small code snippets that you can use as reference in your own project. If you need more information about any of the classes, properties, and/or methods used in any of these snippets, please consult the applicable class documentation provided.
| + | <i>Please note: It is highly recommended that you save the framework to a specific and static location on your computer (e.g. a location where you save other third-party SDKs and frameworks). This can allow you to better use the framework across multiple projects, if needed.</i> |
| | | |
- | === Step 1: Set Client Key ===
| + | <hr/> |
| | | |
- | In your AppDelegate.m file, import the EPrizeMobileSDK and set the client key property for the shared library.
| + | === Include framework into your project === |
| | | |
- | <i>Recommendation: Set this in the</i> application:didFinishLaunchingWithOptions: <i>method. </i>
| + | In your application’s project navigator, click on the General tab in your project’s target. Under “Embedded Binaries”, click the “+” button and select “Add Other” from the dialog box. Navigate to the HWMobileSDK.framework directory you saved from step 1 above, and click “Open”. The HWMobileSDK framework is now included in your project and ready to use. |
| | | |
- | <pre> | + | <hr/> |
- | #import <EPrizeMobileSDK/EPrizeMobileSDK.h>
| + | |
| | | |
- | @implementation AppDelegate
| + | === Import framework as necessary === |
| | | |
- | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
| + | In any class file that needs to utilize the SDK, you will need to import the framework files. You can consult the various [[#Class_Documentation|Class Documentation]] sections for more information about each of the classes included in the SDK. |
- | {
| + | |
- | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
| + | |
| | | |
- | // Set Client Key - Absolutely required to make calls to retrieve configurations
| + | <hr/> |
- | [[EPZPromoLibrary sharedLibrary] setClientKey:@"your_client_key"];
| + | |
| | | |
- | self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
| + | ==== Create App ID ==== |
- | self.window.rootViewController = self.viewController;
| + | |
- | [self.window makeKeyAndVisible];
| + | |
- | return YES;
| + | |
- | }
| + | |
- | </pre>
| + | |
| | | |
- | === Step 2: Conform to Applicable Delegate Protocols ===
| + | In the Apple Developer Center, you will need to create an explicit App ID for your application. |
| | | |
- | Wherever you choose to integrate the retrieval of configuration data and present a promotion using the SDK’s built-in web view controller, you will need to conform to the [[#Class_Documentation:_EPZPromoLibraryDelegate_Protocol_Reference|EPZPromoLibraryDelegate]] and [[#Class_Reference:_EPZPromoWebViewControllerDelegate_Protocol_Reference|EPZPromoWebViewControllerDelegate]] protocols, respectively.
| + | ==== Create Certificate & Export Private Key ==== |
| | | |
- | <pre>
| + | Once you have created your App ID, you will need to create a certificate which you will need to link to the App ID created in the previous step. After you have generated and downloaded the certificate, make sure you double-click the downloaded file to add to Keychain Access. Then, in Keychain Access, find the new private key created, right-click it, and choose the "Export" option. Save the private key as a .p12 file. |
- | #import <EPrizeMobileSDK/EPrizeMobileSDK.h>
| + | |
| | | |
- | @interface ViewController : UIViewController
| + | ==== Create Provisioning Profile ==== |
- | <EPZPromoLibraryDelegate, EPZPromoWebViewControllerDelegate>
| + | |
- | </pre>
| + | |
| | | |
- | === Step 3: Set Delegate and Fetch Promotion Configurations ===
| + | You will also need to make sure you set up a valid provisioning profile for your application in the Apple Developer Center, complete with the applicable App ID and certificates. |
| | | |
- | When you want to fetch promotion configurations, you will need to set the [[#sharedLibrary|sharedLibrary]] [[#delegate|delegate]] and call the [[#fetchPromotionConfigurations|fetchPromotionConfigurations]] method. Additionally, you’ll need to implement the required protocol method [[#promotionConfigurationsRetrieved:|promotionConfigurationsRetrieved:]], and optionally, the [[#promotionConfigurationsFailedWithError:|promotionConfigurationsFailedWithError:]] method.
| + | ==== Submit Required Information to HelloWorld ==== |
| + | Submit a plain text file that includes your App Bundle ID and App Name (see sample below). <b>Submit this file to your HelloWorld account team or Producer.</b> |
| | | |
| + | :<b>Sample Text File</b> |
| <pre> | | <pre> |
- | #import <EPrizeMobileSDK/EPrizeMobileSDK.h>
| + | App Bundle ID: com.helloworld.mobilesdk.demo |
- | | + | App Name: MobileSDK Demo App |
- | @implementation ViewController
| + | |
- | | + | |
- | - (void)viewDidLoad
| + | |
- | {
| + | |
- | [super viewDidLoad];
| + | |
- |
| + | |
- | [[EPZPromoLibrary sharedLibrary] setDelegate:self];
| + | |
- | [[EPZPromoLibrary sharedLibrary] fetchPromotionConfigurations];
| + | |
- | }
| + | |
- | - (void) promotionConfigurationsRetrieved:(NSArray *)promoKeys
| + | |
- | {
| + | |
- | // promoKeys is an array of promotion configuration keys.
| + | |
- | // Use this array as needed to display a promotion, list
| + | |
- | // of promotions, or other call-to-action as needed.
| + | |
- | }
| + | |
- | - (void) promotionConfigurationsFailedWithError:(NSError *)error
| + | |
- | {
| + | |
- | // The error param will contain info about the error so
| + | |
- | // you can handle appropriately.
| + | |
- | }
| + | |
| </pre> | | </pre> |
| | | |
- | === Step 4: Launching and Closing a Promotion === | + | == Sample Integration == |
| | | |
- | If you have at least one active promotion configuration to which you give an accompanying call-to-action, you’ll need a way to display the promotion site in your app. To do so, you need to make an instance of [[#Class_Documentation:_EPZPromoWebViewController|EPZPromoWebViewController]], initializing it with a configuration key. Then set a transition style, set it’s delegate to self, and present it.
| + | The following section outlines steps to get up and running with the EPrizeMobileSDK in your app. These steps provide small code snippets that you can use as reference in your own project. If you need more information about any of the classes, properties, and/or methods used in any of these snippets, please consult the applicable class documentation provided. |
| | | |
- | <i>(Note: In the code snippet below, “config” is an instance of </i>[[#Class_Documentation:_EPZPromoConfiguration|EPZPromoConfiguration]]<i>, and utilizes the shared library’s </i>[[#promotionConfigurationForKey:|promotionConfigurationForKey:]]<i> method, as well as referencing the sharedLibrary to get one of the keys from the promoKeys property. For more information on these classes and how to use them, see the class reference documentation for each. For more information on the concept of configuration keys, see [[#Key_Concepts|Key Concepts]] section in the Getting Started guide.)</i>
| + | === Set Client Key === |
| | | |
- | <pre>
| + | In your AppDelegate.m file, set the [[Mobile_SDK_iOS:_EPZPromoLibrary#clientKey|clientKey]] property for the [[Mobile_SDK_iOS:_EPZPromoLibrary#sharedLibrary|sharedLibrary]]. |
- | EPZPromoConfiguration *config = [[EPZPromoLibrary sharedLibrary] promotionConfigurationForKey:[[[EPZPromoLibrary sharedLibrary] promoKeys] objectAtIndex:0]];
| + | |
| | | |
- | EPZPromoWebViewController *pvc = [[EPZPromoWebViewController alloc] initWithPromoConfigKey:config.configKey options:nil];
| + | <i>Recommendation: Set this in the</i> application:didFinishLaunchingWithOptions: <i>method. </i> |
- | | + | |
- | pvc.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
| + | |
- | | + | |
- | pvc.delegate = self;
| + | |
- | | + | |
- | [self presentViewController:pvc animated:YES completion:nil];
| + | |
- | </pre> | + | |
- | | + | |
- | The [[#Class_Documentation:_EPZPromoWebViewController|EPZPromoWebViewController]] includes a required delegate method, [[#closePromoView:|closePromoView:]], which is shown below. It alerts the delegate when the user has clicked on the “Close” button in the web view controller. When this method is called, you should take the necessary steps to hide and remove the instance of [[#Class_Documentation:_EPZPromoWebViewController|EPZPromoWebViewController]].
| + | |
| | | |
| <pre> | | <pre> |
- | - (void) closePromoView:(EPZPromoWebViewController *)controller | + | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions |
| { | | { |
- | [self dismissViewControllerAnimated:YES completion:nil]; | + | ... |
- | // Add additional logic here, as necessary. | + | // Set Client Key - Absolutely required to integrate with the SDK |
| + | [[EPZPromoLibrary sharedLibrary] setClientKey:@"your_client_key"]; |
| + | ... |
| + | return YES; |
| } | | } |
| </pre> | | </pre> |
| | | |
| + | === Fetch Promotion Configurations === |
| | | |
- | == Class Documentation: EPZPromoLibrary ==
| + | When you want to fetch promotion configurations, you will need to pass in a block that will be triggered when the [[Mobile_SDK_iOS:_EPZPromoLibrary#fetchPromotionConfigurations:|fetchPromotionConfigurations:]] method is complete. Since the same block callback is used for both success and error events, it is advisable to implement a conditional check for the error object in your callback block, like in the code sample below. |
| | | |
- | === Overview ===
| + | For more information on fetching promotion configurations, consult the [[Mobile_SDK_iOS:_EPZPromoLibrary#fetchPromotionConfigurations:|fetchPromotionConfigurations:]] method documentation. |
| | | |
- | The EPZPromoLibrary class is a Singleton class that provides the necessary logic to connect to the ePrize servers. It is the workhorse of the SDK, providing the methods to retrieve and store the full list of promotion configurations. | |
- | | |
- | Since this class is a Singleton, you will not create an instance of it. Rather, you will simply reference the [[#sharedLibrary|sharedLibrary]] property to access the data (properties) stored within the class, and methods to be called from the class. | |
- | | |
- | For example, to set the client key property: | |
| <pre> | | <pre> |
- | [[EPZPromoLibrary sharedLibrary] setClientKey: @"your_key_here”]; | + | [[EPZPromoLibrary sharedLibrary] fetchPromotionConfigurations:^(NSArray *data, NSError *error) { |
| + | if (error) { |
| + | // Handle error as needed. |
| + | } else { |
| + | // Successfully retrieved promotion configurations. |
| + | } |
| + | }]; |
| </pre> | | </pre> |
| | | |
- | ...or to fetch promotion configurations:
| + | === Launching and Closing a Promotion === |
- | <pre>
| + | |
- | [[EPZPromoLibrary sharedLibrary] fetchPromotionConfigurations];
| + | |
- | </pre>
| + | |
| | | |
| + | If you have at least one active promotion configuration to which you give an accompanying call-to-action, you’ll need a way to display the promotion site in your app. To do so, you need to create an instance of [[Mobile_SDK_iOS:_EPZPromoWebViewController|EPZPromoWebViewController]] and add it to your application, similar to the following code sample. Note that "config" makes use of the [[Mobile_SDK_iOS:_EPZPromoLibrary#sharedLibrary|sharedLibrary]] to retrieve the [[Mobile_SDK_iOS:_EPZPromoConfiguration|EPZPromoConfiguration]] object, and the configuration's [[Mobile_SDK_iOS:_EPZPromoConfiguration#configKey|configKey]] is in turn used to initialize the [[Mobile_SDK_iOS:_EPZPromoWebViewController|EPZPromoWebViewController]]. |
| | | |
- | === Tasks ===
| + | For more information, you can consult the documentation for [[Mobile_SDK_iOS:_EPZPromoWebViewController|EPZPromoWebViewController]] and [[Mobile_SDK_iOS:_EPZPromoWebViewControllerDelegate|EPZPromoWebViewControllerDelegate]] |
- | | + | |
- | <b>Getting the Shared Library Instance</b><br />
| + | |
- | [[#sharedLibrary|+ sharedLibrary]]
| + | |
- | | + | |
- | <b>Setting and Getting the Delegate</b><br />
| + | |
- | [[#delegate| delegate]] <i>property</i>
| + | |
- | | + | |
- | <b>Retrieving Promotion Information</b><br />
| + | |
- | [[#fetchPromotionConfigurations|- fetchPromotionConfigurations]]<br />
| + | |
- | [[#promotionConfigurationForKey:|- promotionConfigurationForKey:]]<br />
| + | |
- | [[#promoConfigurations|promoConfigurations]] <i>property</i><br />
| + | |
- | [[#promoKeys|promoKeys]] <i>property</i>
| + | |
- | | + | |
- | <b>Launching a Promotion (in device's native browser)</b><br />
| + | |
- | [[#launchPromotionForKey:|- launchPromotionForKey:]]
| + | |
- | | + | |
- | <b>Accessing the Client Key</b><br />
| + | |
- | [[#clientKey|clientKey]] <i>property</i>
| + | |
- | | + | |
- | <b>SDK Information</b><br />
| + | |
- | [[#version|version]] <i>property</i>
| + | |
- | | + | |
- | | + | |
- | === Properties ===
| + | |
- | | + | |
- | ==== delegate ====
| + | |
- | The receiver's delegate.
| + | |
- | <pre>
| + | |
- | @property (nonatomic, assign) id <[[#Class_Documentation:_EPZPromoLibraryDelegate_Protocol_Reference|EPZPromoLibraryDelegate]]> delegate
| + | |
- | </pre>
| + | |
- | | + | |
- | <b>Discussion</b><br />
| + | |
- | The delegate is sent messages when server data actions are fired. See [[#Class_Documentation:_EPZPromoLibraryDelegate_Protocol_Reference|EPZPromoLibraryDelegate Protocol Reference]] for methods this delegate implements.
| + | |
- | | + | |
- | <b>Availability</b><br />
| + | |
- | Available in version 1.0 and later.
| + | |
- | | + | |
- | <b>Declared In</b><br />
| + | |
- | EPZPromoLibrary.h
| + | |
- | | + | |
- | | + | |
- | ==== clientKey ====
| + | |
- | The client key used by your application.
| + | |
- | <pre>
| + | |
- | @property (nonatomic, copy) NSString *clientKey
| + | |
- | </pre>
| + | |
- | | + | |
- | <b>Discussion</b><br />
| + | |
- | The client key is used to retrieve the list of promotion configurations from the ePrize servers. This value should be set in your App Delegate (in the application:didFinishLaunchingWithOptions: method, for instance) so it is ready to use anywhere in your code.
| + | |
- | | + | |
- | <b>Availability</b><br />
| + | |
- | Available in version 1.0 and later.
| + | |
- | | + | |
- | <b>Declared In</b><br />
| + | |
- | EPZPromoLibrary.h
| + | |
- | | + | |
- | | + | |
- | ==== promoConfigurations ====
| + | |
- | A dictionary of promotion configurations. (read-only)
| + | |
- | <pre>
| + | |
- | @property (nonatomic, readonly) NSDictionary *promoConfigurations
| + | |
- | </pre>
| + | |
- | | + | |
- | <b>Discussion</b><br />
| + | |
- | This property provides a quick and full list of [[#Class_Documentation:_EPZPromoConfiguration|EPZPromoConfiguration]] objects, each keyed with its configuration’s [[#configKey|configKey]] value. It is a more verbose alternative to the [[#promoKeys|promoKeys]] property, which simply provides a list of configuration keys.
| + | |
- | | + | |
- | <b>Availability</b><br />
| + | |
- | Available in version 1.0 and later.
| + | |
- | | + | |
- | <b>Declared In</b><br />
| + | |
- | EPZPromoLibrary.h
| + | |
- | | + | |
- | | + | |
- | ==== promoKeys ====
| + | |
- | An array of promotion configuration keys. (read-only)
| + | |
- | <pre>
| + | |
- | @property (nonatomic, readonly) NSArray *promoKeys
| + | |
- | </pre>
| + | |
- | | + | |
- | <b>Discussion</b><br />
| + | |
- | This property provides a quick list of configuration keys available. It is a smaller alternative to the [[#promoConfigurations|promoConfigurations]] property, which provides a more verbose set of data.
| + | |
- | | + | |
- | <b>Availability</b><br />
| + | |
- | Available in version 1.0 and later.
| + | |
- | | + | |
- | <b>Declared In</b><br />
| + | |
- | EPZPromoLibrary.h
| + | |
- | | + | |
- | | + | |
- | ==== version ====
| + | |
- | The version of the EPrizeMobileSDK. (read-only)
| + | |
- | <pre>
| + | |
- | @property (nonatomic, readonly) float version
| + | |
- | </pre>
| + | |
- | | + | |
- | <b>Discussion</b><br />
| + | |
- | This is a convenience property that returns the version number of the EPrizeMobileSDK framework you are using.
| + | |
- | | + | |
- | <b>Availability</b><br />
| + | |
- | Available in version 1.0 and later.
| + | |
- | | + | |
- | <b>Declared In</b><br />
| + | |
- | EPZPromoLibrary.h
| + | |
- | | + | |
- | | + | |
- | === Class Methods ===
| + | |
- | | + | |
- | ==== sharedLibrary ====
| + | |
- | Returns the singleton library instance.
| + | |
- | <pre>
| + | |
- | + ([[#Class_Documentation:_EPZPromoLibrary|EPZPromoLibrary]] *)sharedLibrary
| + | |
- | </pre>
| + | |
- | | + | |
- | <b>Availability</b><br />
| + | |
- | Available in version 1.0 and later.
| + | |
- | | + | |
- | <b>Declared In</b><br />
| + | |
- | EPZPromoLibrary.h
| + | |
- | | + | |
- | === Instance Methods ===
| + | |
- | | + | |
- | ==== promotionConfigurationForKey: ====
| + | |
- | Returns an instance of the [[#Class_Documentation:_EPZPromoConfiguration|EPZPromoConfiguration]] object, which contains information relevant to a promotion.
| + | |
- | <pre>
| + | |
- | - ([[#Class_Documentation:_EPZPromoConfiguration|EPZPromoConfiguration]] *)promotionConfigurationForKey:(NSString *)key
| + | |
- | </pre>
| + | |
- | | + | |
- | <b>Parameters</b><br />
| + | |
- | key<br />
| + | |
- | <span style="margin-left: 30px;">One of the configuration keys that is stored in the [[#promoKeys|promoKeys]] property. </span>
| + | |
- | | + | |
- | <b>Discussion</b><br />
| + | |
- | This method lets you get an [[#Class_Documentation:_EPZPromoConfiguration|EPZPromoConfiguration]] object with the key specified as a parameter. It is an easy convenience method to use to get access to a promotion’s configuration data. For more information on the [[#Class_Documentation:_EPZPromoConfiguration|EPZPromoConfiguration]] object, see the documentation for [[#Class_Documentation:_EPZPromoConfiguration|EPZPromoConfiguration]].
| + | |
- | | + | |
- | <b>Availability</b><br />
| + | |
- | Available in version 1.0 and later.
| + | |
- | | + | |
- | <b>Declared In</b><br />
| + | |
- | EPZPromoLibrary.h
| + | |
- | | + | |
- | | + | |
- | ==== fetchPromotionConfigurations ====
| + | |
- | Retrieves a list of promotion configurations from the ePrize servers.
| + | |
- | <pre>
| + | |
- | - (void)fetchPromotionConfigurations
| + | |
- | </pre>
| + | |
- | | + | |
- | <b>Discussion</b><br />
| + | |
- | This method makes an asynchronous request to retrieve a list of promotion configuration keys, using the [[#clientKey|clientKey]] property value (which should be set in your App Delegate so it is ready to use when needed). Upon completion of the request, one of the [[#Class_Documentation:_EPZPromoLibraryDelegate_Protocol_Reference|EPZPromoLibraryDelegate]] methods will be called, alerting the delegate of either success or error.
| + | |
- | | + | |
- | <b>Availability</b><br />
| + | |
- | Available in version 1.0 and later.
| + | |
- | | + | |
- | <b>Declared In</b><br />
| + | |
- | EPZPromoLibrary.h
| + | |
- | | + | |
- | | + | |
- | ==== launchPromotionForKey: ====
| + | |
- | Calls the openURL method on the parent app’s UIApplication sharedApplication instance.
| + | |
- | <pre>
| + | |
- | - (void)launchPromotionForKey:(NSString *)key
| + | |
- | </pre>
| + | |
- | | + | |
- | <b>Parameters</b><br />
| + | |
- | key<br />
| + | |
- | <span style="margin-left: 30px;">One of the configuration keys that is stored in the promoKeys property. </span>
| + | |
- | | + | |
- | <b>Discussion</b><br />
| + | |
- | This is a convenience method to easily launch a promotion for a given key, using the device’s default web browser.
| + | |
- | | + | |
- | <i>Note: It is recommended that you do not use this method, but rather create an instance of</i> [[#Class_Documentation:_EPZPromoWebViewController|EPZPromoWebViewController]] <i>and this view to your app so the promotion will be viewed while staying in your app. As a safeguard, this method will not complete if the promotion configuration for the specified key has an</i> [[#openInNativeBrowser|openInNativeBrowser]] <i>value of NO.</i>
| + | |
- | | + | |
- | <b>Availability</b><br />
| + | |
- | Available in version 1.0 and later.
| + | |
- | | + | |
- | <b>Declared In</b><br />
| + | |
- | EPZPromoLibrary.h
| + | |
- | | + | |
- | | + | |
- | == Class Documentation: EPZPromoLibraryDelegate Protocol Reference ==
| + | |
- | | + | |
- | === Overview ===
| + | |
- | | + | |
- | The EPZPromoLibraryDelegate protocol defines methods that a delegate of [[#Class_Documentation:_EPZPromoLibrary|EPZPromoLibrary]] can implement to handle actions pertaining to interactions with the class methods.
| + | |
- | | + | |
- | | + | |
- | === Tasks ===
| + | |
- | | + | |
- | <b>Retrieving Content</b><br />
| + | |
- | [[#promotionConfigurationsRetrieved:|- promotionConfigurationsRetrieved:]] <i>required method</i><br />
| + | |
- | [[#promotionConfigurationsFailedWithError:|- promotionConfigurationsFailedWithError:]] <i>optional method</i>
| + | |
- | | + | |
- | | + | |
- | === Instance Methods ===
| + | |
- | | + | |
- | ==== promotionConfigurationsRetrieved: ====
| + | |
- | Returns a list of promotion configuration keys after successful retrieval.
| + | |
- | <pre>
| + | |
- | - (void) promotionConfigurationsRetrieved:(NSArray *)promoKeys
| + | |
- | </pre>
| + | |
- | | + | |
- | <b>Parameters</b><br />
| + | |
- | promoKeys<br />
| + | |
- | <div style="margin-left: 30px;">An array of promotion configuration keys. Promotion configuration keys are used to retrieve [[#Class_Documentation:_EPZPromoConfiguration|EPZPromoConfiguration]] objects from the [[#Class_Documentation:_EPZPromoLibrary|EPZPromoLibrary]] [[#sharedLibrary|sharedLibrary]] property, and to instantiate an instance of [[#Class_Documentation:_EPZPromoWebViewController|EPZPromoWebViewController]]. Like the name indicates, these are “key” values that allow access to the configuration objects and successful view controller instantiation. Without a valid promo key, you will not be able to retrieve specific promotion configuration data or instantiate web view controllers.
| + | |
- | | + | |
- | <i>Note: This array may be empty, if no current promotions are found for the specified client key. You will be responsible for incorporating logic to determine array length, and add functionality to your app to handle the various scenarios of array length.</i>
| + | |
- | </div>
| + | |
- | | + | |
- | | + | |
- | <b>Discussion</b><br />
| + | |
- | The delegate responds to the callback method from a successful NSURLConnection to retrieve configuration data.
| + | |
- | | + | |
- | <b>Availability</b><br />
| + | |
- | Available in version 1.0 and later.
| + | |
- | | + | |
- | <b>Declared In</b><br />
| + | |
- | EPZPromoLibrary.h
| + | |
- | | + | |
- | | + | |
- | ==== promotionConfigurationsFailedWithError: ====
| + | |
- | Called if retrieving a list of promotion configurations was unsuccessful due to an error.
| + | |
- | <pre>
| + | |
- | - (void) promotionConfigurationsFailedWithError:(NSError *)error
| + | |
- | </pre>
| + | |
- | | + | |
- | <b>Parameters</b><br />
| + | |
- | error<br />
| + | |
- | <div style="margin-left: 30px;">An NSError object containing information with the reason the call to retrieve promotion configurations was unsuccessful.
| + | |
- | | + | |
- | <i>Note: If the error is due to a lack of Internet connectivity, you will need to take appropriate actions to attempt to retrieve promotion configurations again, as the SDK does not automatically attempt to do so.</i>
| + | |
- | </div>
| + | |
- | | + | |
- | | + | |
- | <b>Discussion</b><br />
| + | |
- | The delegate responds to the callback method from an unsuccessful NSURLConnection to retrieve configuration data.
| + | |
- | | + | |
- | <b>Availability</b><br />
| + | |
- | Available in version 1.0 and later.
| + | |
- | | + | |
- | <b>Declared In</b><br />
| + | |
- | EPZPromoLibrary.h
| + | |
- | | + | |
- | | + | |
- | == Class Documentation: EPZPromoConfiguration ==
| + | |
- | | + | |
- | === Overview ===
| + | |
- | | + | |
- | The EPZPromoConfiguration class stores all necessary information specific to a promotion. You can use an instance of this class to gain access to all of the applicable pieces of information you’ll need for reference, display, and functionality. All properties of this class are read-only.
| + | |
- | | + | |
- | <i>Note: There is a method named</i> initWithKey:data: <i>which is not meant to be used outside of the core SDK logic, and thus, is not documented below. </i>
| + | |
- | | + | |
- | | + | |
- | === Tasks ===
| + | |
- | | + | |
- | <b>Getting Promotion Configuration Information</b><br />
| + | |
- | [[#configKey|configKey]] <i>property</i><br />
| + | |
- | [[#configType|configType]] <i>property</i><br />
| + | |
- | [[#displayURL|displayURL]] <i>property</i><br />
| + | |
- | [[#endpointURL|endpointURL]] <i>property</i><br />
| + | |
- | [[#promoTitle|promoTitle]] <i>property</i><br />
| + | |
- | [[#assetURLs|assetURLs]] <i>property</i><br />
| + | |
- | [[#openInNativeBrowser|openInNativeBrowser]] <i>property</i><br />
| + | |
- | [[#endDate|endDate]] <i>property</i><br />
| + | |
- | [[#launchDate|launchDate]] <i>property</i>
| + | |
- | | + | |
- | | + | |
- | === Properties ===
| + | |
- | | + | |
- | ==== configKey ====
| + | |
- | The promotion’s configuration key. (read-only)
| + | |
- | <pre>
| + | |
- | @property (nonatomic, readonly) NSString *configKey
| + | |
- | </pre>
| + | |
- | | + | |
- | <b>Discussion</b><br />
| + | |
- | This property provides a reference to the promotion’s configuration key, which is used in the initialization function of [[#Class_Documentation:_EPZPromoWebViewController|EPZPromoWebViewController]]. This key is also the same key used to store the [[#Class_Documentation:_EPZPromoConfiguration|EPZPromoConfiguration]] object in the [[#Class_Documentation:_EPZPromoLibrary|EPZPromoLibrary]] [[#promoConfigurations|promoConfigurations]] object.
| + | |
- | | + | |
- | <b>Availability</b><br />
| + | |
- | Available in version 1.0 and later.
| + | |
- | | + | |
- | <b>Declared In</b><br />
| + | |
- | EPZPromoConfiguration.h
| + | |
- | | + | |
- | | + | |
- | ==== configType ====
| + | |
- | The promotion’s configuration type. (read-only)
| + | |
- | <pre>
| + | |
- | @property (nonatomic, readonly) NSString *configType
| + | |
- | </pre>
| + | |
- | | + | |
- | <b>Discussion</b><br />
| + | |
- | This property provides a reference to the promotion’s configuration type. As of version 1.0, the only value for this property is “mobileSdkV1”. This property serves little value outside of the core SDK logic.
| + | |
- | | + | |
- | <b>Availability</b><br />
| + | |
- | Available in version 1.0 and later.
| + | |
- | | + | |
- | <b>Declared In</b><br />
| + | |
- | EPZPromoConfiguration.h
| + | |
- | | + | |
- | | + | |
- | ==== displayURL ====
| + | |
- | The promotion’s URL, formatted for display. (read-only)
| + | |
- | <pre>
| + | |
- | @property (nonatomic, readonly) NSString *displayURL
| + | |
- | </pre>
| + | |
- | | + | |
- | <b>Discussion</b><br />
| + | |
- | This property provides a reference to the promotion’s URL, targeted for display. For instance, if a promotion uses a vanity URL, the vanity URL can be the value for this property. Similarly, if a promotion URL has query parameters attached to the URL that are not intended for display, this value may crop off the parameters, resulting in a URL that is more pleasing to the eye.
| + | |
- | | + | |
- | <b>Availability</b><br />
| + | |
- | Available in version 1.0 and later.
| + | |
- | | + | |
- | <b>Declared In</b><br />
| + | |
- | EPZPromoConfiguration.h
| + | |
- | | + | |
- | | + | |
- | ==== endpointURL ====
| + | |
- | The promotion’s full URL. (read-only)
| + | |
- | <pre>
| + | |
- | @property (nonatomic, readonly) NSString *endpointURL
| + | |
- | </pre>
| + | |
- | | + | |
- | <b>Discussion</b><br />
| + | |
- | This property provides a reference to the promotion’s full URL. Unlike the displayURL property, this value may include additional URL information such as query parameters, or a URL that is masked by a vanity URL.
| + | |
- | | + | |
- | <b>Important Note:</b> This is the value that is loaded into the [[#Class_Documentation:_EPZPromoWebViewController|EPZPromoWebViewController]].
| + | |
- | | + | |
- | <b>Availability</b><br />
| + | |
- | Available in version 1.0 and later.
| + | |
- | | + | |
- | <b>Declared In</b><br />
| + | |
- | EPZPromoConfiguration.h
| + | |
- | | + | |
- | | + | |
- | ==== promoTitle ====
| + | |
- | The promotion’s title. (read-only)
| + | |
- | <pre>
| + | |
- | @property (nonatomic, readonly) NSString *promoTitle
| + | |
- | </pre>
| + | |
- | | + | |
- | <b>Discussion</b><br />
| + | |
- | This property provides a reference to the promotion’s title.
| + | |
- | | + | |
- | <b>Availability</b><br />
| + | |
- | Available in version 1.0 and later.
| + | |
- | | + | |
- | <b>Declared In</b><br />
| + | |
- | EPZPromoConfiguration.h
| + | |
- | | + | |
- | | + | |
- | ==== assetURLs ====
| + | |
- | A list of the promotion’s asset URLs. (read-only)
| + | |
- | <pre>
| + | |
- | @property (nonatomic, readonly) NSDictionary *assetURLs
| + | |
- | </pre>
| + | |
- | | + | |
- | <b>Discussion</b><br />
| + | |
- | This property provides a reference to the promotion’s asset URLs, as configured in the ePrize Configuration Service.
| + | |
- | | + | |
- | <i><b>Important Note: </b> There are no set or default key values for this property, as all asset URLs are the responsibility of the party who configures the promotion in the ePrize Configuration Service. As such, if you choose to use asset URLs, it is recommended to do conditional checks for the existence of any dictionary keys you attempt to use, to avoid null values and/or crashes. </i>
| + | |
- | | + | |
- | <b>Availability</b><br />
| + | |
- | Available in version 1.0 and later.
| + | |
- | | + | |
- | <b>Declared In</b><br />
| + | |
- | EPZPromoConfiguration.h
| + | |
- | | + | |
- | | + | |
- | ==== openInNativeBrowser ====
| + | |
- | A flag alerting whether the site is intended to launch in a device’s native browser. (read-only)
| + | |
- | <pre>
| + | |
- | @property (nonatomic, readonly) BOOL *openInNativeBrowser
| + | |
- | </pre>
| + | |
- | | + | |
- | <b>Discussion</b><br />
| + | |
- | This property provides a flag to alert you whether the promotion is intended to launch in a device’s native browser. You can check this value before launching a promotion in your app, and if it is set to YES, you can use the [[#Class_Documentation:_EPZPromoLibrary|EPZPromoLibrary]] method [[#launchPromotionForKey:|launchPromotionForKey:]], which will open the promotion’s URL in the device’s native browser, rather than in the built-in SDK web view.
| + | |
- | | + | |
- | <i>Note: In the interest of giving complete control to your application, the SDK does not automatically open a promotion, either in the native browser or by launching an instance of</i> [[#Class_Documentation:_EPZPromoWebViewController|EPZPromoWebViewController]]<i>. You are responsible for triggering a promotion to be opened by one of these two means.</i>
| + | |
- | | + | |
- | <b>Availability</b><br />
| + | |
- | Available in version 1.0 and later.
| + | |
- | | + | |
- | <b>Declared In</b><br />
| + | |
- | EPZPromoConfiguration.h
| + | |
- | | + | |
- | | + | |
- | ==== endDate ====
| + | |
- | The promotion’s end date. (read-only)
| + | |
- | <pre>
| + | |
- | @property (nonatomic, readonly) NSDate *endDate
| + | |
- | </pre>
| + | |
- | | + | |
- | <b>Discussion</b><br />
| + | |
- | This property provides a reference to the promotion’s end date. If you would like to know and/or display the end date for a promotion, you can use this property to get the value, and then use it as necessary.
| + | |
- | | + | |
- | <b>Availability</b><br />
| + | |
- | Available in version 1.0 and later.
| + | |
- | | + | |
- | <b>Declared In</b><br />
| + | |
- | EPZPromoConfiguration.h
| + | |
- | | + | |
- | | + | |
- | ==== launchDate ====
| + | |
- | The promotion’s launch date. (read-only)
| + | |
- | <pre>
| + | |
- | @property (nonatomic, readonly) NSDate *launchDate
| + | |
- | </pre>
| + | |
- | | + | |
- | <b>Discussion</b><br />
| + | |
- | This property provides a reference to the promotion’s launch date. If you would like to know and/or display the launch date for a promotion, you can use this property to get the value, and then use it as necessary.
| + | |
- | | + | |
- | <b>Availability</b><br />
| + | |
- | Available in version 1.0 and later.
| + | |
- | | + | |
- | <b>Declared In</b><br />
| + | |
- | EPZPromoConfiguration.h
| + | |
- | | + | |
- | | + | |
- | == Class Documentation: EPZPromoWebViewController ==
| + | |
- | | + | |
- | === Overview ===
| + | |
- | | + | |
- | The EPZPromoWebViewController class controls the SDK’s built-in web view. To use, you will need to create an instance of this class, and initialize with a promotion configuration key.
| + | |
- | | + | |
- | <b>Creating a View</b><br />
| + | |
- | To create an instance of EPZPromoWebViewController and add it to your application, you can use code like the following. Note that “config” makes use of the [[#sharedLibrary|sharedLibrary]] for both retrieval of a configuration object, and the configuration key used to retrieve this configuration object.
| + | |
| | | |
| <pre> | | <pre> |
| + | // Get first promotion configuration object |
| EPZPromoConfiguration *config = [[EPZPromoLibrary sharedLibrary] promotionConfigurationForKey:[[[EPZPromoLibrary sharedLibrary] promoKeys] objectAtIndex:0]]; | | EPZPromoConfiguration *config = [[EPZPromoLibrary sharedLibrary] promotionConfigurationForKey:[[[EPZPromoLibrary sharedLibrary] promoKeys] objectAtIndex:0]]; |
| | | |
| + | // Create instance of the view controller |
| EPZPromoWebViewController *pvc = [[EPZPromoWebViewController alloc] initWithPromoConfigKey:config.configKey options:nil]; | | EPZPromoWebViewController *pvc = [[EPZPromoWebViewController alloc] initWithPromoConfigKey:config.configKey options:nil]; |
| | | |
- | pvc.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
| + | // Set delegate |
- | | + | |
| pvc.delegate = self; | | pvc.delegate = self; |
| | | |
| + | // Present view controller |
| [self presentViewController:pvc animated:YES completion:nil]; | | [self presentViewController:pvc animated:YES completion:nil]; |
| </pre> | | </pre> |
| | | |
| + | You will need to conform to the [[Mobile_SDK_iOS:_EPZPromoWebViewControllerDelegate|EPZPromoWebViewControllerDelegate]] protocol, in which one method is required to implement, as seen below. This method alerts the delegate when the user has clicked on the “Close” button in the [[Mobile_SDK_iOS:_EPZPromoWebViewController|EPZPromoWebViewController]]. When this method is called, you should take the necessary steps to hide and remove the instance of the view controller. |
| | | |
- | === Tasks === | |
- | | |
- | <b>Setting and Getting the Delegate</b><br /> | |
- | [[#delegate_2|delegate]] <i>property</i> | |
- | | |
- | <b>Initializing</b><br /> | |
- | [[#initWithPromoConfigKey:options:|- initWithPromoConfigKey:options:]] | |
- | | |
- | | |
- | === Properties === | |
- | | |
- | ==== delegate ==== | |
- | The receiver's delegate. | |
| <pre> | | <pre> |
- | @property (nonatomic, assign) id <[[#Class_Reference:_EPZPromoWebViewControllerDelegate_Protocol_Reference|EPZPromoWebViewControllerDelegate]]> delegate
| + | - (void) closePromoWebView:(EPZPromoWebViewController *)controller |
| + | { |
| + | [self dismissViewControllerAnimated:YES completion:nil]; |
| + | // Add additional logic here, as necessary. |
| + | } |
| </pre> | | </pre> |
| | | |
- | <b>Discussion</b><br />
| + | == Class Documentation == |
- | The delegate is sent messages when the view is created, as well as when it is targeted to close. See [[#Class_Reference:_EPZPromoWebViewControllerDelegate_Protocol_Reference|EPZPromoWebViewControllerDelegate Protocol Reference]] for methods this delegate implements.
| + | The SDK includes a number of available classes, whose specific documentation pages can be accessed by clicking one of the links below. |
- | | + | :* [[Mobile_SDK_iOS: EPZAnalyticsService|EPZAnalyticsService]] |
- | <b>Availability</b><br />
| + | :* [[Mobile_SDK_iOS: EPZConstants|EPZConstants]] |
- | Available in version 1.0 and later.
| + | :* [[Mobile_SDK_iOS: EPZPromoConfiguration|EPZPromoConfiguration]] |
- | | + | :* [[Mobile_SDK_iOS: EPZPromoLibrary|EPZPromoLibrary]] |
- | <b>Declared In</b><br />
| + | :* [[Mobile_SDK_iOS: EPZPromoWebViewController|EPZPromoWebViewController]] |
- | EPZPromoWebViewController.h
| + | :* [[Mobile_SDK_iOS: EPZPromoWebViewControllerDelegate|EPZPromoWebViewControllerDelegate]] |
- | | + | :* [[Mobile_SDK_iOS: EPZString|EPZString]] |
- | | + | :* [[Mobile_SDK_iOS: EPZWebView|EPZWebView]] |
- | === Instance Methods === | + | :* [[Mobile_SDK_iOS: EPZWebViewDelegate|EPZWebViewDelegate]] |
- | | + | |
- | ==== initWithPromoConfigKey:options: ====
| + | |
- | Initializes and returns a newly allocated view object with the specified items from the options.
| + | |
- | <pre>
| + | |
- | - (id) initWithPromoConfigKey:(NSString *)key options:(NSDictionary *)options
| + | |
- | </pre>
| + | |
- | | + | |
- | <b>Parameters</b><br />
| + | |
- | key<br />
| + | |
- | <div style="margin-left: 30px;">The promotion configuration key for the target promotion you wish to show in the view. Promotion configuration keys are stored in the [[#sharedLibrary|sharedLibrary]] [[#promoKeys|promoKeys]] array, and are properties of all instances of [[#Class_Documentation:_EPZPromoConfiguration|EPZPromoConfiguration]] included in the [[#sharedLibrary|sharedLibrary]] [[#promoConfigurations|promoConfigurations]] object.
| + | |
- | | + | |
- | <i>Note: This must be a valid configuration key for a promotion to be successfully loaded. If an invalid key is passed, the view will still be created and returned, but a blank web view will be seen.</i>
| + | |
- | </div>
| + | |
- | | + | |
- | options<br />
| + | |
- | <div style="margin-left: 30px;">A dictionary of optional elements to use for styling the toolbar (and enclosed elements) in the view. If this value is nil, default values will be used for all stylized elements of the web view. Below is a list of all valid elements that can be included in the options dictionary, listed by their dictionary key and the type of class each item must be. Each item includes a short description and its default value.
| + | |
- | | + | |
- | <b>toolBar (UIToolbar)</b><br />
| + | |
- | The toolbar used at the bottom of the view. The toolbar must be 44px tall. If this value varies, you may experience unexpected results in the display.
| + | |
- | <div style="padding-left: 30px;"><i>Default: UIToolbar with barStyle of UIBarStyleBlack</i></div>
| + | |
- | | + | |
- | <b>closeButton (UIBarButtonItem)</b><br />
| + | |
- | The close button used to close the view.
| + | |
- | <div style="padding-left: 30px;"><i>Default: A UIBarButtonItemStyleBordered with label “Close”</i></div>
| + | |
- | | + | |
- | <b>refreshButton (UIBarButtonItem)</b><br />
| + | |
- | The refresh button used to refresh the web page loaded in the view's web view.
| + | |
- | <div style="padding-left: 30px;"><i>Default: UIBarButtonSystemItemRefresh</i></div>
| + | |
- | | + | |
- | <b>backButton (UIBarButtonItem)</b><br />
| + | |
- | The back button used navigate back to the previous page in the view's web view.
| + | |
- | <div style="padding-left: 30px;"><i>Default: An inverted instance of UIBarButtonSystemItemPlay</i></div>
| + | |
- | | + | |
- | <b>forwardButton (UIBarButtonItem)</b><br />
| + | |
- | The forward button used navigate back to the previous page in the view's web view.
| + | |
- | <div style="padding-left: 30px;"><i>Default: UIBarButtonSystemItemPlay</i></div>
| + | |
- | | + | |
- | <b>tintColor (UIColor)</b><br />
| + | |
- | A tint color to apply to the toolbar.
| + | |
- | <div style="padding-left: 30px;"><i>Default: None (no tint color applied)</i></div>
| + | |
- | | + | |
- | </div>
| + | |
- | | + | |
- | | + | |
- | <b>Discussion</b><br />
| + | |
- | This method initializes and returns an instance of [[#Class_Documentation:_EPZPromoWebViewController|EPZPromoWebViewController]]. Once initialized, this view loads the [[#endpointURL|endpointURL]] value for the specified promotion configuration key into an instance of UIWebView. The toolbar and its enclosed elements provide the user ways to close the view, refresh a web page, and navigate back and forward in the web page (when applicable).
| + | |
- | | + | |
- | This view is designed to fill the entire screen of the application, and has appropriate logic to allow for filling the screen even when the device is rotated.
| + | |
- | | + | |
- | <i>Note: There is intentionally no visible address bar in this view, thus preventing a user from navigating away from the intended web page (and its own internal web links).</i>
| + | |
- | | + | |
- | | + | |
- | <b>Availability</b><br />
| + | |
- | Available in version 1.0 and later.
| + | |
- | | + | |
- | <b>Declared In</b><br />
| + | |
- | EPZPromoWebViewController.h
| + | |
- | | + | |
- | | + | |
- | == Class Reference: EPZPromoWebViewControllerDelegate Protocol Reference ==
| + | |
- | | + | |
- | === Overview ===
| + | |
- | | + | |
- | The EPZPromoWebViewControllerDelegate protocol defines methods that a delegate of [[#Class_Documentation:_EPZPromoWebViewController|EPZPromoWebViewController]] can implement to handle actions pertaining to interactions with the class methods.
| + | |
- | | + | |
- | | + | |
- | === Tasks ===
| + | |
- | | + | |
- | <b>Retrieving Content</b><br />
| + | |
- | [[#closePromoView:|- closePromoView:]] <i>required method</i><br /> | + | |
- | [[#promoViewCreated:|- promoViewCreated:]] <i>optional method</i> | + | |
- | | + | |
- | | + | |
- | === Instance Methods ===
| + | |
- | | + | |
- | ==== closePromoView: ====
| + | |
- | Dispatched when the view’s “Close” button is pressed.
| + | |
- | <pre>
| + | |
- | - (void) closePromoView:([[#Class_Documentation:_EPZPromoWebViewController|EPZPromoWebViewController]] *)controller
| + | |
- | </pre>
| + | |
- | | + | |
- | <b>Parameters</b><br />
| + | |
- | controller<br />
| + | |
- | <div style="margin-left: 30px;">The instance of [[#Class_Documentation:_EPZPromoWebViewController|EPZPromoWebViewController]] that dispatched the method.</div>
| + | |
- | | + | |
- | <b>Discussion</b><br />
| + | |
- | The delegate responds to a user clicking on the view’s “Close” button, alerting the delegate to take actions to remove the view from the hierarchy.
| + | |
- | | + | |
- | <b>Availability</b><br />
| + | |
- | Available in version 1.0 and later.
| + | |
- | | + | |
- | <b>Declared In</b><br />
| + | |
- | EPZPromoWebViewController.h
| + | |
- | | + | |
- | | + | |
- | ==== promoViewCreated: ====
| + | |
- | Called when the [[#Class_Documentation:_EPZPromoWebViewController|EPZPromoWebViewController]] view is fully created.
| + | |
- | <pre>
| + | |
- | - (void) promoViewCreated:(EPZPromoWebViewController *)controller
| + | |
- | </pre>
| + | |
- | | + | |
- | <b>Parameters</b><br />
| + | |
- | controller<br />
| + | |
- | <div style="margin-left: 30px;">The instance of [[#Class_Documentation:_EPZPromoWebViewController|EPZPromoWebViewController]] that dispatched the method.</div>
| + | |
- | | + | |
- | <b>Discussion</b><br />
| + | |
- | The delegate responds to the [[#Class_Documentation:_EPZPromoWebViewController|EPZPromoWebViewController]] view being successfully and fully created. This method is a convenience method you can use if you desire to know when the view was created, to handle other actions in other parts of your application.
| + | |
- | | + | |
- | <b>Availability</b><br />
| + | |
- | Available in version 1.0 and later.
| + | |
- | | + | |
- | <b>Declared In</b><br />
| + | |
- | EPZPromoWebViewController.h
| + | |
The SDK includes a number of Singleton classes which you will not create instances of, but rather, can simply reference the shared Singleton property for each respective class. The Singleton classes/properties used in the SDK include:
Version 2.0 of this SDK includes a major shift in the callback logic used. Where version 1.0 used delegates as the primary method of implementing callbacks from the SDK, version 2.0 introduces blocks as the main callback method for the majority of public methods in all Singleton classes. As you will see in the class-specific documentation, there are block arguments for all methods which utilize blocks as the callback methods. This said, there are still instances of delegates and delegate methods, namely in the SDK's built-in view controllers.
The SDK uses a concept of configuration keys to access data about promotions and instantiate certain views. Each active promotion will have an associated configuration key. When the list of active promotions is retrieved, you will have access to an array of these configuration keys. You will use the keys to get access to specific promotion configurations (EPZPromoConfiguration), and to instantiate the SDK's built-in web view controller (EPZPromoWebViewController). The array of keys is stored in the EPZPromoLibrary sharedLibrary for access anywhere in your application.
The SDK is designed to be an easy and practical way to retrieve a list of active promotions your organization is running with HelloWorld, Inc. Once you retrieve a list of active promotions, you can use the SDK to launch a given promotion using an instance of the SDK's built-in web view controller, where the specified promotion will be loaded into a customizable web view and presented to the user - all while remaining in your mobile application.
Please contact your account team or Producer to obtain your copy of the SDK.
In your application’s project navigator, click on the General tab in your project’s target. Under “Embedded Binaries”, click the “+” button and select “Add Other” from the dialog box. Navigate to the HWMobileSDK.framework directory you saved from step 1 above, and click “Open”. The HWMobileSDK framework is now included in your project and ready to use.
In any class file that needs to utilize the SDK, you will need to import the framework files. You can consult the various Class Documentation sections for more information about each of the classes included in the SDK.
In the Apple Developer Center, you will need to create an explicit App ID for your application.
Once you have created your App ID, you will need to create a certificate which you will need to link to the App ID created in the previous step. After you have generated and downloaded the certificate, make sure you double-click the downloaded file to add to Keychain Access. Then, in Keychain Access, find the new private key created, right-click it, and choose the "Export" option. Save the private key as a .p12 file.
You will also need to make sure you set up a valid provisioning profile for your application in the Apple Developer Center, complete with the applicable App ID and certificates.
Submit a plain text file that includes your App Bundle ID and App Name (see sample below). Submit this file to your HelloWorld account team or Producer.
The following section outlines steps to get up and running with the EPrizeMobileSDK in your app. These steps provide small code snippets that you can use as reference in your own project. If you need more information about any of the classes, properties, and/or methods used in any of these snippets, please consult the applicable class documentation provided.
When you want to fetch promotion configurations, you will need to pass in a block that will be triggered when the fetchPromotionConfigurations: method is complete. Since the same block callback is used for both success and error events, it is advisable to implement a conditional check for the error object in your callback block, like in the code sample below.
If you have at least one active promotion configuration to which you give an accompanying call-to-action, you’ll need a way to display the promotion site in your app. To do so, you need to create an instance of EPZPromoWebViewController and add it to your application, similar to the following code sample. Note that "config" makes use of the sharedLibrary to retrieve the EPZPromoConfiguration object, and the configuration's configKey is in turn used to initialize the EPZPromoWebViewController.
The SDK includes a number of available classes, whose specific documentation pages can be accessed by clicking one of the links below.