SPGooglePlacesAutocomplete icon indicating copy to clipboard operation
SPGooglePlacesAutocomplete copied to clipboard

changes in clplacemark of resolveToPlacemark block

Open gaurang212 opened this issue 10 years ago • 6 comments

Due to some changes in the api, the place mark we get from [place resolveToPlacemark:^(CLPlacemark *placemark, NSString *addressString, NSError *error)
block is different now, and there is lot of changes in placemark. so is there any other way to get the latitude and longitude from clplacemark,

i can get latitude and longitude but its too long way by dictionary to dictionary checking. my previous code which is working is following

        [place resolveToPlacemark:^(CLPlacemark *placemark, NSString *addressString, NSError *error) {
            if (error) 
              SPPresentAlertViewWithErrorAndTitle(error, @"Error while getting location");
            }
            else if (placemark)
            {
                id objtest = placemark;

                NSString *str = [NSString stringWithFormat:@"%@",objtest];
                NSArray *chunks = [str componentsSeparatedByString: @";"];

                if (chunks.count >1)
                {
                    NSString *lat = [chunks objectAtIndex:0];
                    NSString *lng = [chunks objectAtIndex:1];

                    selectedLatitude  = [[lat componentsSeparatedByString:@"\""] objectAtIndex:1];
                    selectedLongitude = [[lng componentsSeparatedByString:@"\""] objectAtIndex:1];
                }
                else{
                    selectedLatitude  = [NSString stringWithFormat:@"%f",placemark.location.coordinate.latitude];
                    selectedLongitude = [NSString stringWithFormat:@"%f",placemark.location.coordinate.longitude];
                }
                NSLog(@"selected latitude : %@",selectedLatitude);
                NSLog(@"selected longitude : %@",selectedLongitude);
            }
            else{
                NSLog(@"Anything other...");
            }
        }];
    }

gaurang212 avatar Oct 18 '14 13:10 gaurang212

hi, i had the same problem, for example if I try London or Milan in the Italian language, or if I try Plae d'italie in any language or even other cities did not return lat and lon.

Can you help me please? Thanks in advance

zoelounge avatar Oct 20 '14 16:10 zoelounge

It is resolved now, i download the updated version of this project for testing, and it works fine without any trouble, so i suggest you to remove the previous files of "SPGooglePlacesAutocomplete" and add the updated files and configure it. It works for me.., So Best of luck to you.. @zoelounge

gaurang212 avatar Oct 27 '14 09:10 gaurang212

OK thanks. I just update and it works fine but i notice any trouble. Try you to search "Place d'italie"? It return the name into the list but doesn't return the coordinates.

Thank you for all.

zoelounge avatar Nov 04 '14 16:11 zoelounge

Yes, It has Same problem as previous version for some places even i suffer from this bug. I Found this bug in Previous version, this occurs due to "resolveGecodePlaceToPlacemark", it gives error for some places rather than convert it to Placemark. Basically this function convert address string to placemark, and for some places it can't convert it to placemark and gives error in block.

gaurang212 avatar Nov 05 '14 04:11 gaurang212

OK thank you for all.

zoelounge avatar Nov 06 '14 09:11 zoelounge

Hi, any one can help me with SPGooglePlacesAutocompleteQuery language ? I tray "en" or "ENGLISH" but the result is always in keyboard languages. Thanks in advances.

ZoeVale avatar Nov 17 '14 11:11 ZoeVale