Skip to content
This repository has been archived by the owner on Oct 12, 2018. It is now read-only.

property 'exception' not found on object of type 'AWSTask *' #41

Closed
BerndWessels opened this issue Feb 4, 2017 · 2 comments
Closed

Comments

@BerndWessels
Copy link

I followed the guide here, it works fine on Android, but on IOS I get the following error in XCode property 'exception' not found on object of type 'AWSTask *'

In both places the error is in task.exception

The error is here

RCT_EXPORT_METHOD(getCredentialsAsync:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject){

    //start a separate thread for this to avoid blocking the component queue, since
    //it will have to comunicate with the javascript in the mean time while trying to get the list of logins

    NSString* queueName = [NSString stringWithFormat:@"%@.getCredentialsAsyncQueue",
                           [NSString stringWithUTF8String:dispatch_queue_get_label(self.methodQueue)]
                           ];
    dispatch_queue_t concurrentQueue = dispatch_queue_create([queueName UTF8String], DISPATCH_QUEUE_CONCURRENT);

    dispatch_async(concurrentQueue, ^{

        [[credentialProvider credentials] continueWithBlock:^id(AWSTask *task) {
            if (task.exception){
                dispatch_async(dispatch_get_main_queue(), ^{
                    @throw [NSException exceptionWithName:task.exception.name reason:task.exception.reason userInfo:task.exception.userInfo];
                });
            }

and here

RCT_EXPORT_METHOD(getIdentityIDAsync:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject){
    [[credentialProvider getIdentityId] continueWithBlock:^id(AWSTask *task) {
        if (task.exception){
            dispatch_async(dispatch_get_main_queue(), ^{
                @throw [NSException exceptionWithName:task.exception.name reason:task.exception.reason userInfo:task.exception.userInfo];
            });
        }

Any ideas what might be wrong?

@adrienjt
Copy link
Contributor

adrienjt commented Feb 8, 2017

Yes, https://github.com/aws/aws-sdk-ios/blob/master/CHANGELOG.md#api-changes

AWSTask no longer has exception property and affiliated methods due to Bolts update. This means that AWSTask will not handle exceptions and they will be thrown.

So either delete the if (task.exception) {} blocks from aws-sdk-react-native before you npm pack it (anyway they're just there to rethrow), or downgrade aws-sdk-ios.

@bestimmaa
Copy link

bestimmaa commented Jun 19, 2017

Version < 2.5.0 should work according to release notes

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants