2015-08-25 3 views
-1
task = [[task continueWithSuccessBlock:^id(BFTask *task) 
{  
     NSLog(@"%@: Get profile for identity : %@", NSStringFromSelector(_cmd), cognitoUID); 
     AWSDynamoDBObjectMapper *dynamoDBObjectMapper = [AWSDynamoDBObjectMapper defaultDynamoDBObjectMapper]; 
     return [dynamoDBObjectMapper load:[TPLCognitoUserDBO class] hashKey:cognitoUID rangeKey:nil]; 

     }]continueWithBlock:^id(BFTask *task) 
     { 
      if (task.error) { 
       NSLog(@"%@: The request failed. Error: [%@]",NSStringFromSelector(_cmd), task.error); 
      } 
      if (task.exception) { 
       NSLog(@"%@: The request failed. Exception: [%@]", NSStringFromSelector(_cmd), task.exception); 
      } 
      if (task.result) { 

       TPLCognitoUserDBO *cognitoProfile = task.result; 

       if(cognitoProfile) 
       { 
        NSLog(@"%@: User ID %@ ::",NSStringFromSelector(_cmd), [cognitoProfile TPLHandle]); 
        [userIDFound setString: [cognitoProfile TPLHandle]]; 

       } else { 
        NSLog(@"%@: Output has no records in it.", NSStringFromSelector(_cmd)); 
       } 

      } 

     return nil; 

     }]; 

return task; 

дает мне ошибкуAWSDynamoDB - пустой результат задачи

2015-08-24 22:41:21.539 myplan[9904:815677] -[AWSTask TPLHandle]: unrecognized selector sent to instance

2015-08-24 22:41:21.905 myplan[9904:815766] AWSiOSSDKv2 [Debug] AWSSignature.m line:320 | -[AWSSignatureV4Signer signRequestV4:] | payload {"Key":{"TPLCognitoID":{"S":"some value here"}},"TableName":"TPLCognitoUser"}

2015-08-24 22:41:22.341 myplan[9904:815766] AWSiOSSDKv2 [Verbose] AWSURLResponseSerialization.m line:79 | -[AWSJSONResponseSerializer responseObjectForResponse:originalRequest:currentRequest:data:error:] | Response body: [{}]

** DB Определение

@interface TPLCognitoUserDBO : AWSDynamoDBObjectModel <AWSDynamoDBModeling> 

//Keys 

@property (nonatomic, strong) NSString *TPLCognitoID; 

//Other Attributes 

@property (nonatomic, strong) NSString *TPLHandle; 
+0

Кажется, что 'task.result' является объектом' AWSTask', а не 'TPLCognitoUserDBO'. – Larme

+0

@ Larme: dynamoDBObjectMapper load: [TPLCognitoUserDBO class] - Это должно гарантировать возврат объекта к типу TPLCognitoUserDBO? – himank

+0

NSLog on task.result дает мне это Задача Результат himank

ответ

0

тест результат, показанный тип, но ваш код continueWithBlock:^идентификатор (BFTask * задача). тип задачи не совпадает с вашим кодом. - Yi Zhu

Смежные вопросы