📜  mapkit xcode 中的地理围栏 - 任何代码示例

📅  最后修改于: 2022-03-11 14:59:07.187000             🧑  作者: Mango

代码示例1
//path: folder name if any followed by name of image
func uploadImageToFirebaseStorage(data: Data, path: String, blockCompletedWith: @escaping blockCompletedWith) {
        let metadata = StorageMetadata()
        metadata.contentType = "image/jpeg"

        let store = Storage.storage()
        let storeRef = store.reference().child(path)
        let _ = storeRef.putData(data, metadata: metadata) { (metadata, error) in
            guard let _ = metadata else {
                print("error occured: \(error.debugDescription)")
                blockCompletedWith(false, "")
                return
            }

            storeRef.downloadURL(completion: { (url, error) in
                if let urlText = url?.absoluteString {
                    blockCompletedWith(true, urlText)
                }
                else {
                    blockCompletedWith(false, "")
                }
            })
        }
    }