小编Gus*_*uto的帖子

OffLine时,FIRStorageUploadTask putData无法完成

我正在尝试处理用户在应用程序离线时尝试上传和映像时会发生什么.有时它工作,firebase完成一个域错误,我能够创建一个上传任务,但是,如果设备离线,我最近永远不会调用完成块,我得到一个不在firebase文档中的日志消息.

以下是上传图片的代码:

[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");        
    }];
Run Code Online (Sandbox Code Playgroud)

这是我网上重新上线得到的日志消息:

 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==", …
Run Code Online (Sandbox Code Playgroud)

firebase firebase-storage

6
推荐指数
0
解决办法
248
查看次数

标签 统计

firebase ×1

firebase-storage ×1