Support Topics Documentation Slack YouTube Blog

Auto Generated iOS Code Error - LoadRelationsQueryBuilder


(jeremy) #1

Hi,

I generated the CRUD code from the interface on Backendless. I wanted to view a couple of scenarios. When I tried to compile it I received the below error. Now I’m making the assumption there is now Table called SampleTable, I have attempted to fix this to one of the tables that I have within my database (FlightLog). Being generated I would have thought it would have retrieved the names of the tables within my administration area. Thats what it use to do. I haven’t touched anything to the generated code…ideas?

The error is in the ActionViewController.m

No visible @interface for ‘LoadRelationsQueryBuilder’ declares the selector ‘initWithClass:’


else if ([self.actionType isEqualToString:@“related”]) {

    LoadRelationsQueryBuilder *loadRelationsQueryBuilder = [[LoadRelationsQueryBuilder alloc] initWithClass:[SampleTable class]];    <------THIS LINE HERE

    for (NSString *property in self.properties) {

        [loadRelationsQueryBuilder setGetRelationName:property];

    }

    [backendless.data find:[SampleTable class]

              queryBuilder:[DataQueryBuilder new]

                  response:^(NSArray *retrievedData) {

                      DataCollectionViewController *dataCollectionVC = (DataCollectionViewController *)[self.storyboard instantiateViewControllerWithIdentifier:@"DataCollectionViewController"];

                      dataCollectionVC.data = retrievedData;

                      dataCollectionVC.isSort = NO;

                      dataCollectionVC.actionType = self.actionType;

                      dataCollectionVC.loadRelationsQueryBuilder = loadRelationsQueryBuilder;

                      [self.navigationController pushViewController:dataCollectionVC animated:YES];

                      isRunCode = NO;

                  }

                     error:^(Fault *fault) {

                         resultVC.isSuccess = NO;

                         resultVC.text = fault.message;

                         [self.navigationController pushViewController:resultVC animated:YES];

                         isRunCode = NO;

                     }];

}

Cheers,
Jeremy


(Olga Danylova) #2

Hello jeremy,

The signatures changed a little and we’ll fix this issue as soon as possible.
Please replace

LoadRelationsQueryBuilder *loadRelationsQueryBuilder = [[LoadRelationsQueryBuilder alloc] initWithClass:[SampleTable class]];

with

LoadRelationsQueryBuilder *loadRelationsQueryBuilder = [LoadRelationsQueryBuilder of:[SampleTable class]];

and

[loadRelationsQueryBuilder setGetRelationName:property];

with

[loadRelationsQueryBuilder setRelationName:property];

Regards, Olga


(jeremy) #3

Thanks Olga,

I’ll make the changes today.

Cheers!
Jeremy


(jeremy) #4

One Last thing,

I haven’t tried with SWIFT but I’m making the assumption that it also needs to be changed?

Jeremy


(Olga Danylova) #5

Yes, you’re right:

let loadRelationsQueryBuilder = LoadRelationsQueryBuilder.of(SampleTable.ofClass())!

Regards, Olga


(jeremy) #6

Excellent,

Thank you.

Jeremy