Skip to content

changes in clplacemark of resolveToPlacemark block #17

@gaurang212

Description

@gaurang212

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...");
            }
        }];
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions