Mobile SDK iOS: EPZConstants
From ePrize Developers Wiki
Overview
The EPZConstants class is a simple storage class for constants defined for use in the SDK, and as a convenience for applications using the SDK, so they can make use of the constants as needed (e.g. to avoid typos in string values, to use when defining dictionary keys for configuration options, etc).
Code Samples
Below are a few examples of instances where you may wish to make use of these constants in this class.
Note: Due to the number of constants defined in this class, they are not listed here. You can view the full list of constants in the EPZConstants.h header file in the EPrizeMobileSDK framework.
Checking remote notification for a remote payload ID value
- (void) application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo { // Check notification for remote payload and fetch additional data (if found) NSString *remotePayloadID = [[userInfo objectForKey:EPZ] objectForKey:EPZ_PUSH_KEY_PAYLOAD_ID]; if (remotePayloadID) { [[EPZPushNotificationService sharedService] fetchAdditionalNotificationDataForPayloadID:remotePayloadID callback:^(NSDictionary *data, NSError *error) { // Handle block callback data/error here } } }
Configuring the EPZPromoWebViewController with custom options
NSDictionary *vcOptions = [NSDictionary dictionaryWithObject:[UIColor blueColor] forKey:EPZ_CONFIG_OPTION_TINT_COLOR]; EPZPromoWebViewController *vc = [EPZPromoWebViewController promoWebViewControllerWithURL:@"http://helloworld.com/" options:vcOptions]; [vc setDelegate:self]; [self presentViewController:vc animated:YES completion:nil];
Adding an observer for the NSNotificationCenter (as alternative to delegate methods)
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onEPZPromoWebViewControllerClose:) name:EPZ_NOTIFICATION_PROMO_WEB_VIEW_CLOSED object:nil]; ... - (void) onEPZPromoWebViewControllerClose:(NSNotification *)notification { [self dismissViewControllerAnimated:YES completion:nil]; }