capacitor-community / google-maps

Capacitor Plugin using native Google Maps SDK for Android and iOS.
https://capacitor-community.github.io/google-maps/
MIT License
152 stars 64 forks source link

Map crashes app on ios #222

Closed Timileyin105 closed 1 year ago

Timileyin105 commented 1 year ago

Describe the bug A app works fine on android platform but in ios the app crashes whenever the map is about to be loaded when app is lauched everthing works fine but when page with the map is opened it crahed image i have exc_bad_access i have tried bot the latest version of xocode (14.3) and 14.1 still same

To Reproduce

1.create sample app for ios 2.run to see on simulator

  1. See error

Screenshots image

Timileyin105 commented 1 year ago

@tafelnl your help will be appreciated on this Thanks

tafelnl commented 1 year ago

Unfortunately I can't help without a minimal basic reproduction

Timileyin105 commented 1 year ago

hello @tafelnl

this is my code

just a simple map create throws the error on ios


//component.html

<div id="map" [style]="{height: mapHeight}" #map></div> 

//component.ts
    createMap() {
        if (Capacitor.getPlatform() === 'web') {
            return;
        }
        const { longitude, latitude } = this.cameraPosition;
        const element = this.map.nativeElement;
        const boundingRectEl = element.getBoundingClientRect();
        await CapacitorGoogleMaps.createMap({
            element: boundingRectEl,
            boundingRect: {
                width: Math.round(boundingRectEl.width),
                height: Math.round(boundingRectEl.height),
                x: Math.round(boundingRectEl.x),
                y: Math.round(boundingRectEl.y),
            },
            cameraPosition: {
                zoom: 14,
                target: {
                    latitude, longitude
                }
            },
            preferences: {
                liteMode: false,
                appearance: {
                    style: mapStyle,
                    isMyLocationDotShown: true,
                    type: this.mapService.getMapTypeInt()
                },
                controls: {
                    isCompassButtonEnabled: false,
                    isMyLocationButtonEnabled: true
                }
            }
        }).then(map => {
            this.mapService.currentMapId = map.googleMap.mapId;
            element.setAttribute("data-maps-id", map.googleMap.mapId);
        }, err => {
            console.log(err);
        })
    }

it works normal in android (Android studio) but ios(xcode emulator) i have error and also to archive peoject i have error

tafelnl commented 1 year ago

Unfortunately with such an example people will not be able to help you. Please see here how to create a reproduction:

https://minimum-reproduction.wtf/ https://stackoverflow.com/help/minimal-reproducible-example https://github.com/ionic-team/capacitor/blob/HEAD/CONTRIBUTING.md#creating-a-code-reproduction

tafelnl commented 1 year ago

Closing as stale