AWSMobileAnalyticsERS Class Reference

Inherits from AWSService : NSObject
Declared in AWSMobileAnalyticsERSService.h
AWSMobileAnalyticsERSService.m

Overview

A service which is used to record Amazon Mobile Analytics events

/

  configuration

The service configuration used to instantiate this service client.

@property (nonatomic, strong, readonly) AWSServiceConfiguration *configuration

Discussion

Warning: Once the client is instantiated, do not modify the configuration object. It may cause unspecified behaviors.

Declared In

AWSMobileAnalyticsERSService.h

+ defaultMobileAnalyticsERS

Returns the singleton service client. If the singleton object does not exist, the SDK instantiates the default service client with defaultServiceConfiguration from [AWSServiceManager defaultServiceManager]. The reference to this object is maintained by the SDK, and you do not need to retain it manually.

+ (instancetype)defaultMobileAnalyticsERS

Return Value

The default service client.

Discussion

For example, set the default service configuration in - application:didFinishLaunchingWithOptions:

Swift

 func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    let credentialProvider = AWSCognitoCredentialsProvider(regionType: .USEast1, identityPoolId: "YourIdentityPoolId")
    let configuration = AWSServiceConfiguration(region: .USEast1, credentialsProvider: credentialProvider)
    AWSServiceManager.default().defaultServiceConfiguration = configuration

    return true
}

Objective-C

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
      AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:AWSRegionUSEast1
                                                                                                      identityPoolId:@"YourIdentityPoolId"];
      AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSEast1
                                                                           credentialsProvider:credentialsProvider];
      [AWSServiceManager defaultServiceManager].defaultServiceConfiguration = configuration;

      return YES;
  }

Then call the following to get the default service client:

Swift

 let MobileAnalyticsERS = AWSMobileAnalyticsERS.default()

Objective-C

 AWSMobileAnalyticsERS *MobileAnalyticsERS = [AWSMobileAnalyticsERS defaultMobileAnalyticsERS];

Declared In

AWSMobileAnalyticsERSService.h

+ registerMobileAnalyticsERSWithConfiguration:forKey:

Creates a service client with the given service configuration and registers it for the key.

+ (void)registerMobileAnalyticsERSWithConfiguration:(AWSServiceConfiguration *)configuration forKey:(NSString *)key

Parameters

configuration

A service configuration object.

key

A string to identify the service client.

Discussion

For example, set the default service configuration in - application:didFinishLaunchingWithOptions:

Swift

 func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    let credentialProvider = AWSCognitoCredentialsProvider(regionType: .USEast1, identityPoolId: "YourIdentityPoolId")
    let configuration = AWSServiceConfiguration(region: .USWest2, credentialsProvider: credentialProvider)
    AWSMobileAnalyticsERS.register(with: configuration!, forKey: "USWest2MobileAnalyticsERS")

    return true
}

Objective-C

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
     AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:AWSRegionUSEast1
                                                                                                     identityPoolId:@"YourIdentityPoolId"];
     AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSWest2
                                                                          credentialsProvider:credentialsProvider];

     [AWSMobileAnalyticsERS registerMobileAnalyticsERSWithConfiguration:configuration forKey:@"USWest2MobileAnalyticsERS"];

     return YES;
 }

Then call the following to get the service client:

Swift

 let MobileAnalyticsERS = AWSMobileAnalyticsERS(forKey: "USWest2MobileAnalyticsERS")

Objective-C

 AWSMobileAnalyticsERS *MobileAnalyticsERS = [AWSMobileAnalyticsERS MobileAnalyticsERSForKey:@"USWest2MobileAnalyticsERS"];

Warning: After calling this method, do not modify the configuration object. It may cause unspecified behaviors.

Declared In

AWSMobileAnalyticsERSService.h

+ MobileAnalyticsERSForKey:

Retrieves the service client associated with the key. You need to call + registerMobileAnalyticsERSWithConfiguration:forKey: before invoking this method.

+ (instancetype)MobileAnalyticsERSForKey:(NSString *)key

Parameters

key

A string to identify the service client.

Return Value

An instance of the service client.

Discussion

For example, set the default service configuration in - application:didFinishLaunchingWithOptions:

Swift

 func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    let credentialProvider = AWSCognitoCredentialsProvider(regionType: .USEast1, identityPoolId: "YourIdentityPoolId")
    let configuration = AWSServiceConfiguration(region: .USWest2, credentialsProvider: credentialProvider)
    AWSMobileAnalyticsERS.register(with: configuration!, forKey: "USWest2MobileAnalyticsERS")

    return true
}

Objective-C

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
     AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:AWSRegionUSEast1
                                                                                                     identityPoolId:@"YourIdentityPoolId"];
     AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSWest2
                                                                          credentialsProvider:credentialsProvider];

     [AWSMobileAnalyticsERS registerMobileAnalyticsERSWithConfiguration:configuration forKey:@"USWest2MobileAnalyticsERS"];

     return YES;
 }

Then call the following to get the service client:

Swift

 let MobileAnalyticsERS = AWSMobileAnalyticsERS(forKey: "USWest2MobileAnalyticsERS")

Objective-C

 AWSMobileAnalyticsERS *MobileAnalyticsERS = [AWSMobileAnalyticsERS MobileAnalyticsERSForKey:@"USWest2MobileAnalyticsERS"];

Declared In

AWSMobileAnalyticsERSService.h

+ removeMobileAnalyticsERSForKey:

Removes the service client associated with the key and release it.

+ (void)removeMobileAnalyticsERSForKey:(NSString *)key

Parameters

key

A string to identify the service client.

Discussion

Warning: Before calling this method, make sure no method is running on this client.

Declared In

AWSMobileAnalyticsERSService.h

– putEvents:

Record a batch of events

- (AWSTask *)putEvents:(AWSMobileAnalyticsERSPutEventsInput *)request

Parameters

request

A container for the necessary parameters to execute the PutEvents service method.

Return Value

An instance of AWSTask. On successful execution, task.result will be nil. On failed execution, task.error may contain an NSError with AWSMobileAnalyticsERSErrorDomain domain and the following error code: AWSMobileAnalyticsERSErrorBadRequest.

Declared In

AWSMobileAnalyticsERSService.h

– putEvents:completionHandler:

Record a batch of events

- (void)putEvents:(AWSMobileAnalyticsERSPutEventsInput *)request completionHandler:(void ( ^ _Nullable ) ( NSError *_Nullable error ))completionHandler

Parameters

request

A container for the necessary parameters to execute the PutEvents service method.

completionHandler

The completion handler to call when the load request is complete. error - An error object that indicates why the request failed, or nil if the request was successful. On failed execution, error may contain an NSError with AWSMobileAnalyticsERSErrorDomain domain and the following error code: AWSMobileAnalyticsERSErrorBadRequest.

Declared In

AWSMobileAnalyticsERSService.h