制作一个涉及上传图片的简单应用程序,但我不知道如何解决此错误。是的,我是Swift和Firebase的新手。
Source = ../Src
Source_Files = $(Source)/File_1.c \
$(Source)/File_2.c
Obj = ./Obj
Object_Files = $(notdir $(Source_Files))
Object_Files := $(Object_Files:.c=.o)
Object_Files := $(addprefix $(Obj)/, $(Object_Files))
all: $(Object_Files)
$(Object_Files): $(Source_Files)
@echo Compile $<
@gcc -o $@ -c $<
收到此错误:
guard let image = self.plusPhotoButton.imageView?.image else { return }
guard let uploadData = image.jpegData(compressionQuality: 0.3) else { return }
let filename = NSUUID().uuidString
let storageRef = Storage.storage().reference().child("profile_images").child(filename)
storageRef.putData(uploadData, metadata: nil, completion: { (metadata, err) in
if let err = err {
print("Failed to upload profile image:", err)
return
}
},
storageRef.downloadURL(completion: { (downloadURL, err) in
if let err = err {
print("Failed to fetch downloadURL:", err)
return
}
guard let profileImageUrl = downloadURL?.absoluteString else { return }
print("Successfully uploaded profile image:", profileImageUrl)
})
)}
}
答案 0 :(得分:0)
括号中有一个错误。
guard let image = self.plusPhotoButton.imageView?.image else { return }
guard let uploadData = image.jpegData(compressionQuality: 0.3) else { return }
let filename = NSUUID().uuidString
let storageRef = Storage.storage().reference().child("profile_images").child(filename)
storageRef.putData(uploadData, metadata: nil, completion: { (metadata, err) in
if let err = err {
print("Failed to upload profile image:", err)
return
}
},
storageRef.downloadURL(completion: { (downloadURL, err) in
if let err = err {
print("Failed to fetch downloadURL:", err)
return
}
guard let profileImageUrl = downloadURL?.absoluteString else { return }
print("Successfully uploaded profile image:", profileImageUrl)
})
)} //Replace With })
}