fileService doesn't work all the time, seems to be hit or miss if the connection is stable...

Hi Backendless,

All is going well with my project but the fileServices seems a bit flaky as I am getting an array of server errors.

So here is my code:

@try {

        NSString *fileName = [NSString stringWithFormat:@"img/%0.0f.jpeg",[[NSDate date] timeIntervalSince1970] ];

        BackendlessFile *uploadFile = [backendless.fileService upload:fileName content:UIImageJPEGRepresentation(sellImageA, 0.1)];

     

        NSLog(@"UPLOADED FILE URL: %@",uploadFile);

    }

    @catch (Fault *fault) {

        NSLog(@"APPARENTLY A FAULT: %@", fault);

    }

Pretty much all the time I call the method, via a button, I get the below error but if I hit the button again straight away it works and the file is saved. In fact the file saves every subsequent time.

FAULT = ‘0’ [HTTP 0] <server error>

If I close the app and reopen it I get the same issue allover again, it won’t work but then if i try again it works. is there anything I can do to stabilise this process?

I have also noticed the error -1001 server Timeout. if that helps…

cheers

Steve

Just some more info… If I live the app running after a successful upload and then try again about 10 minutes later it fails. After the failure it uploads straight away.

Hi Steve,

Could you please give more information about the errors you get? Error message, codes, etc.

Regards,
Mark

Hi Mark,

to be honest the codes are as above, I have had Fault = 0 and Fault -1001. -1001 said NSDomainURL timeout.

I just ran it again and the error was: FAULT = ‘0’ [HTTP 0] <server error>

This time a second try didn’t work resulting in the same error but third time did work.

regards

Steve

Could you please post file URL after a successful upload?

I just tried again and it works every time really quickly! Here is the URL: UPLOADED FILE URL: <BackendlessFile> -> fileURL: https://api.backendless.com/ddd01b59-b51a-8389-ffff-4d043cad3f00/v1/files/img/1455559456.jpeg

UPLOADED FILE URL: <BackendlessFile> -> fileURL: https://api.backendless.com/ddd01b59-b51a-8389-ffff-4d043cad3f00/v1/files/img/1455563202.jpeg