AWSTask is not instantiable

466 Views Asked by At

I have a problem with AWSTask in the fact that it's not instantiating properly. I was wondering what I was doing wrong and why this was happening. I know that it's not an error with the "Expected ')'" because I have replaced AWSTask with BFTask just to check if it worked and it did. I apologize if this seems like a novice question but I am very unsure of what I should be doing to resolve this error.

my code:

AWSLambdaInvoker *lambdaInvoker = [AWSLambdaInvoker defaultLambdaInvoker];
NSDictionary *parameters = @{@"List" : list,
                             @"isError" : @NO};
[[lambdaInvoker invokeFunction:@"updateList" JSONObject:parameters] continueWithBlock:^id(AWSTask* task) {
    if (task.error) {
        NSLog(@"Error: %@", task.error);
    }
    if (task.exception) {
        NSLog(@"Exception: %@", task.exception);
    }
    if (task.result) {
        NSLog(@"Result: %@", task.result);

        dispatch_async(dispatch_get_main_queue(), ^{
            NSLog(@"%@",task.result);
        });
    }
    return nil;
}];

my imports:

#import <AWSCore/AWSCore.h>
#import <AWSCognito/AWSCognito.h>    
#import <AWSDynamoDB/AWSDynamoDB.h>
#import <AWSLambda/AWSLambda.h>

Note: I've tried importing these as well to see if the error would resolve:

#import <AWSCore/AWSCore.h>
#import <AWSS3/AWSS3.h>
#import <AWSDynamoDB/AWSDynamoDB.h>
#import <AWSSQS/AWSSQS.h>
#import <AWSSNS/AWSSNS.h>
#import <AWSCognito/AWSCognito.h>
1

There are 1 best solutions below

0
On

I dont think AWSTask is necessary to do what you want.

The following works for me using BFTask instead:

#import <AWSLambda/AWSLambda.h>

AWSLambdaInvoker *lambdaInvoker = [AWSLambdaInvoker defaultLambdaInvoker];
NSDictionary *parameters = @{@"List" : @"",
                         @"isError" : @NO};
[[lambdaInvoker invokeFunction:@"updateList" JSONObject:parameters] continueWithBlock:^id(BFTask *task)
{
//...
return nil;
}];