0

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>
user2977578
  • 413
  • 5
  • 19
  • Resolved: BFTask works just as well. No idea why AWSTask wasn't working though. – user2977578 Jul 01 '15 at 00:04
  • Hi, i had some problem regarding invoking lambda function.Need your help. http://stackoverflow.com/questions/31354780/lambda-function-issue-in-aws-ios-sdk. – user1068810 Jul 11 '15 at 15:28

1 Answers1

0

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;
}];
user1709076
  • 2,538
  • 9
  • 38
  • 59