【发布时间】:2017-03-16 23:02:41
【问题描述】:
所以我有两个问题:
- 所以我有一个对象,其中两个属性正在存储图像。我成功地将图像存储在 Firebase 存储中,并将图像名称存储在数据库中。假设我有两张照片,我只有一张。
- 我只能访问图片的名称,但每当我尝试打印出 url 时,它总是说
nil。
这里有一些代码sn-p:
//MARK: - Make Object
func makeObjectPost(title: String, imageTitle: UIImage, content: [String: AnyObject]) {
//Make a new post object
let postObject = PostModel()
postObject.title = title
postObject.imageTitle = returningImageData(image: imageTitle)
postObject.content = content
//Save the new object to firebase
postObject.save { (ref, error) in
if error != nil {
print(error?.localizedDescription)
}
}
}
makeObjectPost(title: "Third Post", imageTitle: #imageLiteral(resourceName: "william-iven-19844"), content: makeContentDict(contentPost: currPost))
【问题讨论】:
-
我的回答对你有帮助吗?
标签: ios swift firebase firebase-storage