NSString *filetotest=[NSString stringWithFormat:@"/var/mobile/Containers/Data/Application/3A203232-06BF-41CB-8456-1F2341C06934/Documents/"];
NSString *filessss=[NSString stringWithFormat:@"/var/mobile/Containers/Data/Application/3A203232-06BF-41CB-8456-1F2341C06934/Documents/100445.jpg"];
// File located on disk
NSURL *localFile = [NSURL URLWithString:filessss];
[@"100445.jpg" writeToFile:filetotest atomically:YES];
// Get a reference to the storage service using the default Firebase App
FIRStorage *storage = [FIRStorage storage];
// Create a storage reference from our storage service
FIRStorageReference *storageRef = [storage referenceForURL:@"gs://gnts-xxxxx.appspot.com"];
// Create a reference to the file you want to upload
FIRStorageReference *riversRef = [storageRef child:@"Test"];
// Upload the file to the path "images/rivers.jpg"
FIRStorageUploadTask *uploadTask = [riversRef putFile:localFile metadata:nil completion:^(FIRStorageMetadata *metadata, NSError *error) {
if (error != nil) {
// Uh-oh, an error occurred!
} else {
// Metadata contains file metadata such as size, content-type, and download URL.
NSURL *downloadURL = metadata.downloadURL;
}
}];
получила ошибкуфайла Тело недостижимой ошибки при загрузке файла firebase
CFURLResourceIsReachable не удался, поскольку он был принят в URL, который не имеет схем
файл Body недостижим:/вар/мобильный/Контейнеры /Data/Application/3A203232-06BF-41CB-8456-1F2341C06934/Documents/100445.jpg Ошибка домена = NSCocoaErrorDomain Code = 4 «Файл не существует».
Вместо 'NSURL * лок_файл = [NSURL URLWithString: filessss];', используя 'NSURL * лок_файл = [NSURL fileURLWithPath: filessss];' – nynohu