Firebase Storage에서 머리를 쓰려고합니다. 나는 온라인으로 보았고 이미지를 가져 오는 두 가지 방법을 시도했다. 이 두 가지의 차이점은 무엇입니까? (둘 다 일한다).Firebase 스토리지 검색 이미지
내 중포 기지 데이터베이스에서 photoUrl을 얻을 그래서 후에 : 당신이 그것을 사용하지 않아야 첫 번째 방법에 관한
1.
if let data = NSData(contentsOfURL: NSURL(string:photoUrl)!)
{
let myImage = UIImage(data: data)!
MyImageCache.sharedCache.setObject(myImage, forKey: self.key)
//etc
}
2.
self.storage.referenceForURL(photoUrl).dataWithMaxSize(1 * 1024 * 1024) { (data, error) -> Void in
if (error != nil)
{
print(error)
}
else
{
let myImage = UIImage(data: data!)
MyImageCache.sharedCache.setObject(myImage!, forKey: self.key)
//etc
}
}