How to open native ios map application by adding pin at specific lat and lng from Objective C.
            Asked
            
        
        
            Active
            
        
            Viewed 199 times
        
    -5
            
            
        - 
                    bhai mene answer Diya hai.. like kr do.. – Bijender Singh Shekhawat Jan 10 '19 at 12:05
 
1 Answers
0
            
            
        And for Swift 3 and swift 4
let apiKey = "https://www.google.com/maps/dir/" + userCurrentLocation.coordinate.latitude + "," + userCurrentLocation.coordinate.longitude + "/" + nextCurrentLocation.coordinate.latitude + "," + nextCurrentLocation.coordinate.longitude
var url = URL(string: apikey)
UIApplication.shared.open(openUrl!, options: [:]) { (res:Bool) in
            }
For objective c use
 NSString *apikey = [NSString stringWithFormat:@"https://www.google.co.in/maps/dir/%f,%f/%f,%f",userCurrentLocation.coordinate.latitude,userCurrentLocation.coordinate.longitude,nextCurrentLocation.coordinate.latitude,nextCurrentLocation.coordinate.longitude;
NSURL *url = [NSURL URLWithString:apikey];
[[UIApplication sharedApplication] openURL:url];
        Bijender Singh Shekhawat
        
- 3,934
 - 2
 - 30
 - 36