0
私は現在、現在のユーザイメージイメージのURLを取得するためにこの機能を持っていますが、私はcurrentUserの代わりにユーザIDを使用します。すべては、コードでうまく動作しますが、私はちょうどあなたのFirebaseデータの構造についての詳しい情報は、完全な答えを与える必要があるFirebaseはユーザIDを持つユーザイメージを取得します
func ProfileImage(imageUIView:UIImageView,borderColor:UIColor,borderWidth:CGFloat,backgroundColor:UIColor,noimageLabel:UILabel){
if let user = FIRAuth.auth()?.currentUser{
if user.photoURL == ""{
print("database image is not set")
imageUIView.layer.borderWidth = borderWidth
imageUIView.layer.masksToBounds = false
imageUIView.layer.borderColor = borderColor.CGColor
imageUIView.layer.cornerRadius = imageUIView.frame.height/2
imageUIView.clipsToBounds = true
imageUIView.backgroundColor = backgroundColor
noimageLabel.hidden = false
}else{
imageUIView.layer.borderWidth = borderWidth
imageUIView.layer.masksToBounds = false
imageUIView.layer.borderColor = borderColor.CGColor
imageUIView.layer.cornerRadius = imageUIView.frame.height/2
imageUIView.clipsToBounds = true
imageUIView.backgroundColor = backgroundColor
noimageLabel.hidden = true
var imageUrl = NSData(contentsOfURL: user.photoURL!)
imageUIView.image = UIImage(data: imageUrl!)
}
}
}
このように、あなたはUIDを知らないので他のユーザープロフィールを見ることができません。 –