0
新的Firebase可讓您爲用戶提供NSURL個人資料圖片媒體資源,但我在顯示時遇到問題。下面是我如何保存呢......如何在iOS Swift中顯示新Firebase中的配置文件圖像?
let user = FIRAuth.auth()?.currentUser
if let user = user {
let changeRequest = user.profileChangeRequest()
changeRequest.photoURL = searchURL
changeRequest.commitChangesWithCompletion { error in
if let _ = error {
print("Try Again")
} else {
print("Photo Updated")
self.profileImage.image = image
}
}
}
這是我正在努力找回它....
if let user = FIRAuth.auth()?.currentUser
{
let name = user.displayName
let pic = user.photoURL
self.displayNameLBL.text = name
if pic != nil
{
print(pic!)
let urlString: String = pic!.path!
self.profileImage.image = UIImage(named: urlString)
//self.profileImage.image = UIImage(data: pic! as NSURL)
}else
{
self.profileImage.image = UIImage(named: "imagePlaceholder")
}
}
我越來越user.displayName
但不圖片。
這是行不通的。你在哪裏得到了'stringURL'?我不確定是否從UIImagePicker正確保存它。 –