AWSIoTData

Objective-C

@interface AWSIoTData

Swift

class AWSIoTData

IoT data

IoT data enables secure, bi-directional communication between Internet-connected things (such as sensors, actuators, embedded devices, or smart appliances) and the Amazon Web Services cloud. It implements a broker for applications and things to publish messages over HTTP (Publish) and retrieve, update, and delete shadows. A shadow is a persistent representation of your things and their state in the Amazon Web Services cloud.

Find the endpoint address for actions in IoT data by running this CLI command:

aws iot describe-endpoint --endpoint-type iot:Data-ATS

The service name used by Amazon Web ServicesSignature Version 4 to sign requests is: iotdevicegateway.

  • 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 *configuration
  • 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.

    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 IoTData = AWSIoTData.default()
    

    Objective-C

    AWSIoTData *IoTData = [AWSIoTData defaultIoTData];
    

    Declaration

    Objective-C

    + (nonnull instancetype)defaultIoTData;

    Swift

    class func `default`() -> Self

    Return 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)
       AWSIoTData.register(with: configuration!, forKey: "USWest2IoTData")
    
       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];
    
        [AWSIoTData registerIoTDataWithConfiguration:configuration forKey:@"USWest2IoTData"];
    
        return YES;
    }
    

    Then call the following to get the service client:

    Swift

    let IoTData = AWSIoTData(forKey: "USWest2IoTData")
    

    Objective-C

    AWSIoTData *IoTData = [AWSIoTData IoTDataForKey:@"USWest2IoTData"];
    

    Warning

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

    Declaration

    Objective-C

    + (void)registerIoTDataWithConfiguration:(id)configuration
                                      forKey:(nonnull NSString *)key;

    Swift

    class func register(withConfiguration configuration: Any!, forKey key: String)

    Parameters

    configuration

    A service configuration object.

    key

    A string to identify the service client.

  • Retrieves the service client associated with the key. You need to call + registerIoTDataWithConfiguration: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)
       AWSIoTData.register(with: configuration!, forKey: "USWest2IoTData")
    
       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];
    
        [AWSIoTData registerIoTDataWithConfiguration:configuration forKey:@"USWest2IoTData"];
    
        return YES;
    }
    

    Then call the following to get the service client:

    Swift

    let IoTData = AWSIoTData(forKey: "USWest2IoTData")
    

    Objective-C

    AWSIoTData *IoTData = [AWSIoTData IoTDataForKey:@"USWest2IoTData"];
    

    Declaration

    Objective-C

    + (nonnull instancetype)IoTDataForKey:(nonnull NSString *)key;

    Swift

    convenience init(forKey key: String)

    Parameters

    key

    A 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)removeIoTDataForKey:(nonnull NSString *)key;

    Swift

    class func remove(forKey key: String)

    Parameters

    key

    A string to identify the service client.

  • Deletes the shadow for the specified thing.

    Requires permission to access the DeleteThingShadow action.

    For more information, see DeleteThingShadow in the IoT Developer Guide.

    See

    AWSIoTDataDeleteThingShadowRequest

    See

    AWSIoTDataDeleteThingShadowResponse

    Declaration

    Objective-C

    - (id)deleteThingShadow:(nonnull AWSIoTDataDeleteThingShadowRequest *)request;

    Swift

    func deleteThingShadow(_ request: AWSIoTDataDeleteThingShadowRequest) -> Any!

    Parameters

    request

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

    Return Value

    An instance of AWSTask. On successful execution, task.result will contain an instance of AWSIoTDataDeleteThingShadowResponse. On failed execution, task.error may contain an NSError with AWSIoTDataErrorDomain domain and the following error code: AWSIoTDataErrorResourceNotFound, AWSIoTDataErrorInvalidRequest, AWSIoTDataErrorThrottling, AWSIoTDataErrorUnauthorized, AWSIoTDataErrorServiceUnavailable, AWSIoTDataErrorInternalFailure, AWSIoTDataErrorMethodNotAllowed, AWSIoTDataErrorUnsupportedDocumentEncoding.

  • Deletes the shadow for the specified thing.

    Requires permission to access the DeleteThingShadow action.

    For more information, see DeleteThingShadow in the IoT Developer Guide.

    See

    AWSIoTDataDeleteThingShadowRequest

    See

    AWSIoTDataDeleteThingShadowResponse

    Declaration

    Objective-C

    - (void)deleteThingShadow:(nonnull AWSIoTDataDeleteThingShadowRequest *)request
            completionHandler:
                (void (^_Nullable)(AWSIoTDataDeleteThingShadowResponse *_Nullable,
                                   NSError *_Nullable))completionHandler;

    Swift

    func deleteThingShadow(_ request: AWSIoTDataDeleteThingShadowRequest) async throws -> AWSIoTDataDeleteThingShadowResponse

    Parameters

    request

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

    completionHandler

    The completion handler to call when the load request is complete. response - A response object, or nil if the request failed. 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 AWSIoTDataErrorDomain domain and the following error code: AWSIoTDataErrorResourceNotFound, AWSIoTDataErrorInvalidRequest, AWSIoTDataErrorThrottling, AWSIoTDataErrorUnauthorized, AWSIoTDataErrorServiceUnavailable, AWSIoTDataErrorInternalFailure, AWSIoTDataErrorMethodNotAllowed, AWSIoTDataErrorUnsupportedDocumentEncoding.

  • Gets the details of a single retained message for the specified topic.

    This action returns the message payload of the retained message, which can incur messaging costs. To list only the topic names of the retained messages, call ListRetainedMessages.

    Requires permission to access the GetRetainedMessage action.

    For more information about messaging costs, see Amazon Web Services IoT Core pricing - Messaging.

    See

    AWSIoTDataGetRetainedMessageRequest

    See

    AWSIoTDataGetRetainedMessageResponse

    Declaration

    Objective-C

    - (id)getRetainedMessage:(nonnull AWSIoTDataGetRetainedMessageRequest *)request;

    Swift

    func getRetainedMessage(_ request: AWSIoTDataGetRetainedMessageRequest) -> Any!

    Parameters

    request

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

    Return Value

    An instance of AWSTask. On successful execution, task.result will contain an instance of AWSIoTDataGetRetainedMessageResponse. On failed execution, task.error may contain an NSError with AWSIoTDataErrorDomain domain and the following error code: AWSIoTDataErrorInvalidRequest, AWSIoTDataErrorResourceNotFound, AWSIoTDataErrorThrottling, AWSIoTDataErrorUnauthorized, AWSIoTDataErrorServiceUnavailable, AWSIoTDataErrorInternalFailure, AWSIoTDataErrorMethodNotAllowed.

  • Gets the details of a single retained message for the specified topic.

    This action returns the message payload of the retained message, which can incur messaging costs. To list only the topic names of the retained messages, call ListRetainedMessages.

    Requires permission to access the GetRetainedMessage action.

    For more information about messaging costs, see Amazon Web Services IoT Core pricing - Messaging.

    See

    AWSIoTDataGetRetainedMessageRequest

    See

    AWSIoTDataGetRetainedMessageResponse

    Declaration

    Objective-C

    - (void)getRetainedMessage:
                (nonnull AWSIoTDataGetRetainedMessageRequest *)request
             completionHandler:
                 (void (^_Nullable)(AWSIoTDataGetRetainedMessageResponse *_Nullable,
                                    NSError *_Nullable))completionHandler;

    Swift

    func retainedMessage(_ request: AWSIoTDataGetRetainedMessageRequest) async throws -> AWSIoTDataGetRetainedMessageResponse

    Parameters

    request

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

    completionHandler

    The completion handler to call when the load request is complete. response - A response object, or nil if the request failed. 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 AWSIoTDataErrorDomain domain and the following error code: AWSIoTDataErrorInvalidRequest, AWSIoTDataErrorResourceNotFound, AWSIoTDataErrorThrottling, AWSIoTDataErrorUnauthorized, AWSIoTDataErrorServiceUnavailable, AWSIoTDataErrorInternalFailure, AWSIoTDataErrorMethodNotAllowed.

  • Gets the shadow for the specified thing.

    Requires permission to access the GetThingShadow action.

    For more information, see GetThingShadow in the IoT Developer Guide.

    See

    AWSIoTDataGetThingShadowRequest

    See

    AWSIoTDataGetThingShadowResponse

    Declaration

    Objective-C

    - (id)getThingShadow:(nonnull AWSIoTDataGetThingShadowRequest *)request;

    Swift

    func getThingShadow(_ request: AWSIoTDataGetThingShadowRequest) -> Any!

    Parameters

    request

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

    Return Value

    An instance of AWSTask. On successful execution, task.result will contain an instance of AWSIoTDataGetThingShadowResponse. On failed execution, task.error may contain an NSError with AWSIoTDataErrorDomain domain and the following error code: AWSIoTDataErrorInvalidRequest, AWSIoTDataErrorResourceNotFound, AWSIoTDataErrorThrottling, AWSIoTDataErrorUnauthorized, AWSIoTDataErrorServiceUnavailable, AWSIoTDataErrorInternalFailure, AWSIoTDataErrorMethodNotAllowed, AWSIoTDataErrorUnsupportedDocumentEncoding.

  • Gets the shadow for the specified thing.

    Requires permission to access the GetThingShadow action.

    For more information, see GetThingShadow in the IoT Developer Guide.

    See

    AWSIoTDataGetThingShadowRequest

    See

    AWSIoTDataGetThingShadowResponse

    Declaration

    Objective-C

    - (void)getThingShadow:(nonnull AWSIoTDataGetThingShadowRequest *)request
         completionHandler:
             (void (^_Nullable)(AWSIoTDataGetThingShadowResponse *_Nullable,
                                NSError *_Nullable))completionHandler;

    Swift

    func thingShadow(_ request: AWSIoTDataGetThingShadowRequest) async throws -> AWSIoTDataGetThingShadowResponse

    Parameters

    request

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

    completionHandler

    The completion handler to call when the load request is complete. response - A response object, or nil if the request failed. 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 AWSIoTDataErrorDomain domain and the following error code: AWSIoTDataErrorInvalidRequest, AWSIoTDataErrorResourceNotFound, AWSIoTDataErrorThrottling, AWSIoTDataErrorUnauthorized, AWSIoTDataErrorServiceUnavailable, AWSIoTDataErrorInternalFailure, AWSIoTDataErrorMethodNotAllowed, AWSIoTDataErrorUnsupportedDocumentEncoding.

  • Lists the shadows for the specified thing.

    Requires permission to access the ListNamedShadowsForThing action.

    See

    AWSIoTDataListNamedShadowsForThingRequest

    See

    AWSIoTDataListNamedShadowsForThingResponse

    Declaration

    Objective-C

    - (id)listNamedShadowsForThing:
        (nonnull AWSIoTDataListNamedShadowsForThingRequest *)request;

    Swift

    func listNamedShadows(forThing request: AWSIoTDataListNamedShadowsForThingRequest) -> Any!

    Parameters

    request

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

    Return Value

    An instance of AWSTask. On successful execution, task.result will contain an instance of AWSIoTDataListNamedShadowsForThingResponse. On failed execution, task.error may contain an NSError with AWSIoTDataErrorDomain domain and the following error code: AWSIoTDataErrorResourceNotFound, AWSIoTDataErrorInvalidRequest, AWSIoTDataErrorThrottling, AWSIoTDataErrorUnauthorized, AWSIoTDataErrorServiceUnavailable, AWSIoTDataErrorInternalFailure, AWSIoTDataErrorMethodNotAllowed.

  • Lists the shadows for the specified thing.

    Requires permission to access the ListNamedShadowsForThing action.

    See

    AWSIoTDataListNamedShadowsForThingRequest

    See

    AWSIoTDataListNamedShadowsForThingResponse

    Declaration

    Objective-C

    - (void)listNamedShadowsForThing:
                (nonnull AWSIoTDataListNamedShadowsForThingRequest *)request
                   completionHandler:
                       (void (^_Nullable)(
                           AWSIoTDataListNamedShadowsForThingResponse *_Nullable,
                           NSError *_Nullable))completionHandler;

    Swift

    func listNamedShadows(forThing request: AWSIoTDataListNamedShadowsForThingRequest) async throws -> AWSIoTDataListNamedShadowsForThingResponse

    Parameters

    request

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

    completionHandler

    The completion handler to call when the load request is complete. response - A response object, or nil if the request failed. 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 AWSIoTDataErrorDomain domain and the following error code: AWSIoTDataErrorResourceNotFound, AWSIoTDataErrorInvalidRequest, AWSIoTDataErrorThrottling, AWSIoTDataErrorUnauthorized, AWSIoTDataErrorServiceUnavailable, AWSIoTDataErrorInternalFailure, AWSIoTDataErrorMethodNotAllowed.

  • Lists summary information about the retained messages stored for the account.

    This action returns only the topic names of the retained messages. It doesn’t return any message payloads. Although this action doesn’t return a message payload, it can still incur messaging costs.

    To get the message payload of a retained message, call GetRetainedMessage with the topic name of the retained message.

    Requires permission to access the ListRetainedMessages action.

    For more information about messaging costs, see Amazon Web Services IoT Core pricing - Messaging.

    See

    AWSIoTDataListRetainedMessagesRequest

    See

    AWSIoTDataListRetainedMessagesResponse

    Declaration

    Objective-C

    - (id)listRetainedMessages:
        (nonnull AWSIoTDataListRetainedMessagesRequest *)request;

    Swift

    func listRetainedMessages(_ request: AWSIoTDataListRetainedMessagesRequest) -> Any!

    Parameters

    request

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

    Return Value

    An instance of AWSTask. On successful execution, task.result will contain an instance of AWSIoTDataListRetainedMessagesResponse. On failed execution, task.error may contain an NSError with AWSIoTDataErrorDomain domain and the following error code: AWSIoTDataErrorInvalidRequest, AWSIoTDataErrorThrottling, AWSIoTDataErrorUnauthorized, AWSIoTDataErrorServiceUnavailable, AWSIoTDataErrorInternalFailure, AWSIoTDataErrorMethodNotAllowed.

  • Lists summary information about the retained messages stored for the account.

    This action returns only the topic names of the retained messages. It doesn’t return any message payloads. Although this action doesn’t return a message payload, it can still incur messaging costs.

    To get the message payload of a retained message, call GetRetainedMessage with the topic name of the retained message.

    Requires permission to access the ListRetainedMessages action.

    For more information about messaging costs, see Amazon Web Services IoT Core pricing - Messaging.

    See

    AWSIoTDataListRetainedMessagesRequest

    See

    AWSIoTDataListRetainedMessagesResponse

    Declaration

    Objective-C

    - (void)
        listRetainedMessages:
            (nonnull AWSIoTDataListRetainedMessagesRequest *)request
           completionHandler:
               (void (^_Nullable)(AWSIoTDataListRetainedMessagesResponse *_Nullable,
                                  NSError *_Nullable))completionHandler;

    Swift

    func listRetainedMessages(_ request: AWSIoTDataListRetainedMessagesRequest) async throws -> AWSIoTDataListRetainedMessagesResponse

    Parameters

    request

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

    completionHandler

    The completion handler to call when the load request is complete. response - A response object, or nil if the request failed. 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 AWSIoTDataErrorDomain domain and the following error code: AWSIoTDataErrorInvalidRequest, AWSIoTDataErrorThrottling, AWSIoTDataErrorUnauthorized, AWSIoTDataErrorServiceUnavailable, AWSIoTDataErrorInternalFailure, AWSIoTDataErrorMethodNotAllowed.

  • Publishes an MQTT message.

    Requires permission to access the Publish action.

    For more information about MQTT messages, see MQTT Protocol in the IoT Developer Guide.

    For more information about messaging costs, see Amazon Web Services IoT Core pricing - Messaging.

    See

    AWSIoTDataPublishRequest

    Declaration

    Objective-C

    - (id)publish:(nonnull AWSIoTDataPublishRequest *)request;

    Swift

    func publish(_ request: AWSIoTDataPublishRequest) -> Any!

    Parameters

    request

    A container for the necessary parameters to execute the Publish 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 AWSIoTDataErrorDomain domain and the following error code: AWSIoTDataErrorInternalFailure, AWSIoTDataErrorInvalidRequest, AWSIoTDataErrorUnauthorized, AWSIoTDataErrorMethodNotAllowed, AWSIoTDataErrorThrottling.

  • Publishes an MQTT message.

    Requires permission to access the Publish action.

    For more information about MQTT messages, see MQTT Protocol in the IoT Developer Guide.

    For more information about messaging costs, see Amazon Web Services IoT Core pricing - Messaging.

    See

    AWSIoTDataPublishRequest

    Declaration

    Objective-C

    - (void)publish:(nonnull AWSIoTDataPublishRequest *)request
        completionHandler:(void (^_Nullable)(NSError *_Nullable))completionHandler;

    Swift

    func publish(_ request: AWSIoTDataPublishRequest) async throws

    Parameters

    request

    A container for the necessary parameters to execute the Publish 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 AWSIoTDataErrorDomain domain and the following error code: AWSIoTDataErrorInternalFailure, AWSIoTDataErrorInvalidRequest, AWSIoTDataErrorUnauthorized, AWSIoTDataErrorMethodNotAllowed, AWSIoTDataErrorThrottling.

  • Updates the shadow for the specified thing.

    Requires permission to access the UpdateThingShadow action.

    For more information, see UpdateThingShadow in the IoT Developer Guide.

    See

    AWSIoTDataUpdateThingShadowRequest

    See

    AWSIoTDataUpdateThingShadowResponse

    Declaration

    Objective-C

    - (id)updateThingShadow:(nonnull AWSIoTDataUpdateThingShadowRequest *)request;

    Swift

    func updateThingShadow(_ request: AWSIoTDataUpdateThingShadowRequest) -> Any!

    Parameters

    request

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

    Return Value

    An instance of AWSTask. On successful execution, task.result will contain an instance of AWSIoTDataUpdateThingShadowResponse. On failed execution, task.error may contain an NSError with AWSIoTDataErrorDomain domain and the following error code: AWSIoTDataErrorConflict, AWSIoTDataErrorRequestEntityTooLarge, AWSIoTDataErrorInvalidRequest, AWSIoTDataErrorThrottling, AWSIoTDataErrorUnauthorized, AWSIoTDataErrorServiceUnavailable, AWSIoTDataErrorInternalFailure, AWSIoTDataErrorMethodNotAllowed, AWSIoTDataErrorUnsupportedDocumentEncoding.

  • Updates the shadow for the specified thing.

    Requires permission to access the UpdateThingShadow action.

    For more information, see UpdateThingShadow in the IoT Developer Guide.

    See

    AWSIoTDataUpdateThingShadowRequest

    See

    AWSIoTDataUpdateThingShadowResponse

    Declaration

    Objective-C

    - (void)updateThingShadow:(nonnull AWSIoTDataUpdateThingShadowRequest *)request
            completionHandler:
                (void (^_Nullable)(AWSIoTDataUpdateThingShadowResponse *_Nullable,
                                   NSError *_Nullable))completionHandler;

    Swift

    func updateThingShadow(_ request: AWSIoTDataUpdateThingShadowRequest) async throws -> AWSIoTDataUpdateThingShadowResponse

    Parameters

    request

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

    completionHandler

    The completion handler to call when the load request is complete. response - A response object, or nil if the request failed. 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 AWSIoTDataErrorDomain domain and the following error code: AWSIoTDataErrorConflict, AWSIoTDataErrorRequestEntityTooLarge, AWSIoTDataErrorInvalidRequest, AWSIoTDataErrorThrottling, AWSIoTDataErrorUnauthorized, AWSIoTDataErrorServiceUnavailable, AWSIoTDataErrorInternalFailure, AWSIoTDataErrorMethodNotAllowed, AWSIoTDataErrorUnsupportedDocumentEncoding.