FIRStorageUploadTask putData does not end when OffLine

I am trying to process what happens when the user tries to download and the image when the application is disconnected. Sometimes this works, and firebase fails with a domain error, and I can create a boot task, but recently the termination block is never called if the device is offline, and I get a log message that is not in the firebase documentation.

Here is a snippet of code to download the image:

[self.storageRef child:imagePath] putData:imageData metadata:fileMeta completion:^(FIRStorageMetadata * _Nullable metadata, NSError * _Nullable error) { if (error) { NSLog(@"Error uploading: %@", error); //create local task [self createUploadTaskForCurrentUserWithContentType:fileMeta.contentType filePath:imagePath isPhoto:NO]; return; } NSLog(@"Project image upload successful"); }]; 

and here is the log message, after which after I will return via the Internet:

  2017-03-08 15:57:27.513 TEST[15661:822730] unexpected response data (uploading to the wrong URL?) { "name": "-KejhLQPdFBNfyWyqCfS/1489006585133.jpg", "bucket": "test-8822d.appspot.com", "generation": "1489006647755852", "metageneration": "1", "contentType": "image/jpeg", "timeCreated": "2017-03-08T20:57:27.683Z", "updated": "2017-03-08T20:57:27.683Z", "storageClass": "STANDARD", "size": "169509", "md5Hash": "5ZYpGG7d7jUthRIlM6yTAg==", "contentEncoding": "identity", "contentDisposition": "inline; filename*=utf-8''1489006585133.jpg", "crc32c": "4+FzAg==", "etag": "CMyIu4Lmx9ICEAE=", "downloadTokens": "570aa9ec-d97d-4e82-8feb-c8688f9d67c8" } 

Note. This works fine online, only the problem is trying to run the code during battery life.

+5
source share

Source: https://habr.com/ru/post/1265204/


All Articles