Collection Response

Handles responses for all Mobile SDK Collection requests.

Properties:

  • Sub-responses (array)
  • Sub-response properties:
    • Object ID (string)
    • Success (Boolean)
    • Errors (array)
    • JSON (dictionary)

iOS 

Swift 

Response handling:

1let parsedResponse = CollectionResponse(try response.asJson() as! [Any])
2let objId = parsedResponse.subResponses[0].objectId  // String; can be nil
3let success = parsedResponse.subResponses[0].success // Boolean
4let errors = parsedResponse.subResponses[0].errors   // Array of CollectionErrorResponse objects with
5                                                      // status code, message and fields

Objective-C 

Response handling:

1SFSDKCollectionResponse* parsedResponse = [[SFSDKCollectionResponse alloc]
2    initWith:response];
3parsedResponse.subResponses[0].objectId
4parsedResponse.subResponses[0].success
5parsedResponse.subResponses[0].errors // NSArray<SFSDKCollectionErrorResponse*> with status
6                                            // code, message and fields

Android 

Kotlin 

Response handling:

1val parsedResponse = CollectionResponse(response.asJSONArray())
2val objId = parsedResponse.subResponses[0].id         // a string or null
3val success = parsedResponse.subResponses[0].success  // a boolean
4val errors = parsedResponse.subResponses[0].errors    // a CollectionSubResponse.ErrorResponse object
5                                                      // with status code, message and fields

Java 

Response handling:

1CollectionResponse parsedResponse =
2    new CollectionResponse(response.asJSONArray());
3String objId = parsedResponse.subResponses.get(0).id; // can be null
4Boolean success =
5    parsedResponse.subResponses.get(0).success;
6List<CollectionResponse.ErrorResponse> errors =
7    parsedResponse.subResponses.get(0).errors;

See Also 

We've Moved

Welcome to the new home of the Mobile SDK Developer Guide! For now, the Japanese guide can be found in PDF form.