Save MKPointAnnotation to Firestore

96 Views Asked by At

I have [mkmapview annotations] which is array of MKPointAnnotation

I am trying to save ti to FireStore as array but is not accepted the MKPointAnnotation object

then I try to convert MKPointAnnotation to FIRGeoPoint but no luck

for (MKPointAnnotation *point in annotationsArray) {
        FIRGeoPoint *FirAnnotations;
        FirAnnotations = [FirAnnotations initWithLatitude:point.coordinate.latitude longitude:point.coordinate.longitude];
        NSLog(@"FirAnnotations: %@",FirAnnotations);
    }

annotationsArray is [mkmapview annotations]

always get null

1

There are 1 best solutions below

0
Bosoud On BEST ANSWER

i'am attempting to use the FirAnnotations pointer to call init but it's nil and i should be using the FIRGeoPoint there.

for (MKPointAnnotation *point in annotationsArray) {
        FIRGeoPoint *FirAnnotations;
        FirAnnotations = [[FIRGeoPoint alloc] initWithLatitude:point.coordinate.latitude                                                longitude:point.coordinate.longitude];
        NSLog(@"annotations: %@",annotations);
}