[iOS] findID callbacks both error handler and response handler

We found a following issue.

  • After using following API, both the response handler and the error handler are call backed.
    This occurs only on the Async API. The Sync API works fine.
-(void)findID:(id)objectID relationsDepth:(int)relationsDepth response:(void(^)(id result))responseBlock error:(void(^)(Fault *))errorBlock;
- (void)test_02_Data_08_RelationsFindIdAsync {
    [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
    XCTestExpectation *documentOpenExpectation = [self expectationWithDescription:@"document open"];
    RelationsAddress *address = [RelationsAddress addressWithStreet:@"TN 55" city:@"Lynchburg" state:@"Tennessee"];
    RelationsContact *owner = [RelationsContact contactWithName:@"Jack Daniels" phone:@"777-777-777" age:147 title:@"Favorites" address:address];
    RelationsPhoneBook *phoneBook = [RelationsPhoneBook phoneBookWithOwner:owner];
    RelationsPhoneBook *savedPhoneBook = [backendless.persistenceService save:phoneBook];
    NSLog(@"savedPhoneBook.objectId = %@", savedPhoneBook.objectId);
    [[backendless.persistenceService of:[RelationsPhoneBook class]] findID:savedPhoneBook.objectId relationsDepth:2 response:^(RelationsPhoneBook *findId) {
        NSLog(@"findId.objectId = %@", findId.objectId);
        RelationsContact *findIdOwner = findId.owner;
        XCTAssert([findIdOwner homeAddress] != nil && [[findIdOwner name] isEqualToString:[owner name]] && [findIdOwner age] == [owner age] && [[findIdOwner phone] isEqualToString:[owner phone]] && [[findIdOwner title] isEqualToString:[owner title]] );
        [documentOpenExpectation fulfill];
    } error:^(Fault *fault) {
        NSLog(@"FAULT = %@ <%@>", fault.message, fault.detail);
        XCTAssert(false);
    }];


    [self waitForExpectationsWithTimeout:10 handler:^(NSError *error) {
    }];


    [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
}
  • Output
2015-03-17 14:37:18.686 backendless-test[1745:60b] savedPhoneBook.objectId = ACED52EC-80A7-870E-FF6F-56B7CC561000
2015-03-17 14:37:20.443 backendless-test[1745:60b] findId.objectId = ACED52EC-80A7-870E-FF6F-56B7CC561000
2015-03-17 14:37:20.453 backendless-test[1745:60b] FAULT = Unable to retrieve data - unknown entity <Unable to retrieve data - unknown entity>

Attached zip file contains the data models which used by above sample code.
Regards,

issue142.zip (8.05kB)

Following api also call backs both subscriptionResponse handler and subscriptionError handler.

-(void)subscribe:(NSString *)channelName subscriptionResponse:(void(^)(NSArray *))subscriptionResponseBlock subscriptionError:(void(^)(Fault *))subscriptionErrorBlock response:(void(^)(BESubscription *))responseBlock error:(void(^)(Fault *))errorBlock;
-(void)subscribe:(NSString *)channelName subscriptionResponse:(void(^)(NSArray *))subscriptionResponseBlock subscriptionError:(void(^)(Fault *))subscriptionErrorBlock subscriptionOptions:(SubscriptionOptions *)subscriptionOptions response:(void(^)(BESubscription *))responseBlock error:(void(^)(Fault *))errorBlock;

This also occurs Async API. (Sync API works fine.)
The error message was “Subscription ID is not set”.

Hi Niro,

These bugs have been fixed - try again from https://github.com/Backendless/ios-SDK

I have verified the issue with github SDK (03.23.2015) and it is fixed now.
Thank you!