小编Bri*_*vie的帖子

Firebase成功上传到firebase存储后获取下载URL

我正在尝试将单个图像上传到Firebase存储,然后获取其下载URL并将其分配给变量.

我可以成功将我的图像上传到firebase,但是我无法检索下载网址.这是我已经尝试过的.

upload() {
    let storageRef = firebase.storage().ref();
    let success = false;

    for (let selectedFile of [(<HTMLInputElement>document.getElementById('file')).files[0]]) {
      let router = this.router;
      let af = this.af;
      let folder = this.folder;
      let path = `/${this.folder}/${selectedFile.name}`;
      var iRef = storageRef.child(path);
      iRef.put(selectedFile).then((snapshot) => {
        console.log('Uploaded a blob or file! Now storing the reference at', `/${this.folder}/images/`);
        af.list(`/${folder}/images/`).push({ path: path, filename: selectedFile.name })
      });
    }

    // This part does not work
    iRef.getDownloadURL().then((url) => {this.image = url});
    console.log('IREF IS ' + iRef)
    console.log('IMAGEURL IS ' + …
Run Code Online (Sandbox Code Playgroud)

javascript firebase firebase-realtime-database firebase-storage angular

12
推荐指数
4
解决办法
9480
查看次数

Swift:添加方向按钮以固定注释

我有一个使用 MKMapView 显示公司位置的应用程序。当用户访问联系页面时,屏幕顶部会出现一张地图,其中有一根大头针落下,它会显示我们的位置。单击地图图钉时,它会在注释中显示公司名称。

我使用 back4app 将公司地址从存储在 Parse 后端的数据中拉入 MKMApView。

我的这一切都工作得很好,但是,当我单击地图图钉并显示公司名称时,我试图在其中添加一个汽车图标按钮,以便用户可以获得前往我们公司的路线。

这是我必须设置注释的代码:

func addPinOnMap(_ address: String) {
    var hotelClass = PFObject(className: HOTEL_CLASS_NAME)
    hotelClass = hotelArray[0]

    if mapView.annotations.count != 0 {
        annotation = mapView.annotations[0] 
        mapView.removeAnnotation(annotation)
    }

    // Make a search on the Map
    localSearchRequest = MKLocalSearchRequest()
    localSearchRequest.naturalLanguageQuery = address
    localSearch = MKLocalSearch(request: localSearchRequest)

    localSearch.start { (localSearchResponse, error) -> Void in

        // Add PointAnnonation text and a Pin to the Map
        self.pointAnnotation = MKPointAnnotation()
        self.pointAnnotation.title = "\(hotelClass[HOTEL_NAME]!)"
        self.pointAnnotation.coordinate = CLLocationCoordinate2D( latitude: localSearchResponse!.boundingRegion.center.latitude, longitude:localSearchResponse!.boundingRegion.center.longitude) …
Run Code Online (Sandbox Code Playgroud)

maps mkmapview mkannotation swift

2
推荐指数
1
解决办法
2982
查看次数