Closed IbrahimElkhatib closed 1 year ago
I believe this will solve your problem:
CapacitorGoogleMaps.addMarker({ coordinate: { latitude: this.nearestReader.latitude, longitude: this.nearestReader.longitude }, iconUrl: 'assets/images/icons/location-pin.png', });
The icon.url
should be an actual URL. You provided it with a relative path, which doesn't work unfortunately.
Describe the bug I am trying to add a marker with a custom icon from the assets folder, I tried to set the url with: "assets/images/icons/location-pin.png", "../../assets/images/icons/location-pin.png", and "public/assets/images/icons/location-pin.png" with no luck.
To Reproduce Steps to reproduce the behavior:
Expected behavior The marker icon should change to the custom icon instead of the default marker.
Additional context
Error from Xcode debugger console: Task <60ED9F6B-1DAF-4912-813E-2C658DF00898>.<1> finished with error [-1002] Error Domain=NSURLErrorDomain Code=-1002 "unsupported URL" UserInfo={NSLocalizedDescription=unsupported URL, NSErrorFailingURLStringKey=assets/images/icons/location-pin.png, NSErrorFailingURLKey=assets/images/icons/location-pin.png, _NSURLErrorRelatedURLSessionTaskErrorKey=( "LocalDataTask <60ED9F6B-1DAF-4912-813E-2C658DF00898>.<1>" ), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <60ED9F6B-1DAF-4912-813E-2C658DF00898>.<1>, NSUnderlyingError=0x6000029c36c0 {Error Domain=kCFErrorDomainCFNetwork Code=-1002 "(null)"}}