AWSMobileAnalyticsERS
Objective-C
@interface AWSMobileAnalyticsERS
Swift
class AWSMobileAnalyticsERS
A service which is used to record Amazon Mobile Analytics events
-
The service configuration used to instantiate this service client.
Warning
Once the client is instantiated, do not modify the configuration object. It may cause unspecified behaviors.Declaration
Objective-C
@property (nonatomic, strong, readonly) AWSServiceConfiguration *_Nonnull configuration;Swift
var configuration: UnsafeMutablePointer<Int32> { get } -
Returns the singleton service client. If the singleton object does not exist, the SDK instantiates the default service client with
defaultServiceConfigurationfrom[AWSServiceManager defaultServiceManager]. The reference to this object is maintained by the SDK, and you do not need to retain it manually.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];Declaration
Objective-C
+ (nonnull instancetype)defaultMobileAnalyticsERS;Swift
class func `default`() -> SelfReturn Value
The default service client.
-
Creates a service client with the given service configuration and registers it for the key.
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.
Declaration
Objective-C
+ (void)registerMobileAnalyticsERSWithConfiguration: (nonnull AWSServiceConfiguration *)configuration forKey:(nonnull NSString *)key;Swift
class func register(withConfiguration configuration: Any!, forKey key: String)Parameters
configurationA service configuration object.
keyA string to identify the service client.
-
Retrieves the service client associated with the key. You need to call
+ registerMobileAnalyticsERSWithConfiguration:forKey:before invoking this method.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"];Declaration
Objective-C
+ (nonnull instancetype)MobileAnalyticsERSForKey:(nonnull NSString *)key;Swift
convenience init(forKey key: String)Parameters
keyA string to identify the service client.
Return Value
An instance of the service client.
-
Removes the service client associated with the key and release it.
Warning
Before calling this method, make sure no method is running on this client.
Declaration
Objective-C
+ (void)removeMobileAnalyticsERSForKey:(nonnull NSString *)key;Swift
class func remove(forKey key: String)Parameters
keyA string to identify the service client.
-
Record a batch of events
See
AWSMobileAnalyticsERSPutEventsInput
Declaration
Objective-C
- (id)putEvents:(nonnull AWSMobileAnalyticsERSPutEventsInput *)request;Swift
func putEvents(_ request: AWSMobileAnalyticsERSPutEventsInput) -> Any!Parameters
requestA container for the necessary parameters to execute the PutEvents service method.
Return Value
An instance of
AWSTask. On successful execution,task.resultwill benil. On failed execution,task.errormay contain anNSErrorwithAWSMobileAnalyticsERSErrorDomaindomain and the following error code:AWSMobileAnalyticsERSErrorBadRequest. -
Record a batch of events
See
AWSMobileAnalyticsERSPutEventsInput
Declaration
Objective-C
- (void)putEvents:(nonnull AWSMobileAnalyticsERSPutEventsInput *)request completionHandler:(void (^_Nullable)(NSError *_Nullable))completionHandler;Swift
func putEvents(_ request: AWSMobileAnalyticsERSPutEventsInput, completionHandler: ((Error?) -> Void)? = nil)Parameters
requestA container for the necessary parameters to execute the PutEvents service method.
completionHandlerThe completion handler to call when the load request is complete.
error- An error object that indicates why the request failed, ornilif the request was successful. On failed execution,errormay contain anNSErrorwithAWSMobileAnalyticsERSErrorDomaindomain and the following error code:AWSMobileAnalyticsERSErrorBadRequest.
View on GitHub
Install in Dash
AWSMobileAnalyticsERS Class Reference