하지만, 혹시 # 39 m, s # 39 I& it& 경우 시작 주소를 만들 수 있으며, 현재의 Location" " 매핑하므로 , , 그렇게 책갈피 매핑하므로 app& # 39 의 위치 처리 코드를 사용할 수 있습니다. 내 구글 검색 결과가 격려했다고 번번이 놓쳤다.
예를 들면 다음과 같습니다.
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat: @"http://maps.google.com/maps?saddr=%@&daddr=%@", myLatLong, latlong]]];
현재 위치를 호출하십시오 미라트롱 '대신' 북마크 제외하고는 되는 게 아니다.
현재 위치를 사용해야 할 수 있는 핵심 위치에 있지만, 여기에서 latitudetm / 긴 페어당 매핑됨 너회가 라우트를 맞추기바인딩 주소 또는 위치를 확인할 수 있습니다. 같은 있습니다.
<! - 모든 언어: > 로비치 랭 -;
CLLocationCoordinate2D currentLocation = [self getCurrentLocation];
// this uses an address for the destination. can use lat/long, too with %f,%f format
NSString* address = @"123 Main St., New York, NY, 10001";
NSString* url = [NSString stringWithFormat: @"http://maps.google.com/maps?saddr=%f,%f&daddr=%@",
currentLocation.latitude, currentLocation.longitude,
[address stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
[[UIApplication sharedApplication] openURL: [NSURL URLWithString: url]];
마지막으로 현재 위치를 찾을 수 없는 경우, 명시적으로 사용하지 않는 것이 스맥랜드의 코레로카션 사용하려면 ' (http://maps.google.com/maps) =, = %@" url 대신,' 다드르 Current+Location& @"? 사데르, 다음 [이 링크를 참조) 에서 제공하는 것을 내가 아래에 의견을] (http://www.martip.net/blog/localized-current-location-string-for-iphone-apps) 방법은 Current+Location 지역화합니다 구체화하십시오. 그러나 당신은 다른 문서화되지 않은 기능, 그리고 제이슨 매크리리 점을 악용해 이 향후 릴리스에서는 아래 안정적으로 작동하지 않을 수 있습니다.
, 매핑하므로 당초 구글 · 애플 · 구글 앱스를 사용하는 매핑하며 지금은 각기 다른 매핑하므로.
1) 구글 지도 애플리케이션 (앱) 을 사용하여 프로파일링하려는 라우트를 사용할 경우 (해당 콩구그레마프스 uirl 구성표가] (https://developers.google.com/maps/documentation/ios/urlscheme # 방향):
NSString* url = [NSString stringWithFormat: @"comgooglemaps://?daddr=%@&directionsmode=driving",
[address stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
BOOL opened = [[UIApplication sharedApplication] openURL: [NSURL URLWithString: url]];
2) 매핑하며 '새' 마크마피템 클래스를 사용하여 애플 iOS 6 사용할 수 있습니다. [지켜보리니 애플 API 문서 여기서요] (https://developer.apple.com/documentation/mapkit/mkmapitem)
기본적으로 이 같은 일이 사용할 경우 경로설정하기 위치좌표 ('라트롱') 대상:
MKPlacemark* place = [[MKPlacemark alloc] initWithCoordinate: latlong addressDictionary: nil];
MKMapItem* destination = [[MKMapItem alloc] initWithPlacemark: place];
destination.name = @"Name Here!";
NSArray* items = [[NSArray alloc] initWithObjects: destination, nil];
NSDictionary* options = [[NSDictionary alloc] initWithObjectsAndKeys:
MKLaunchOptionsDirectionsModeDriving,
MKLaunchOptionsDirectionsModeKey, nil];
[MKMapItem openMapsWithItems: items launchOptions: options];
Ios, iOS 6 의 동일한 코드를 모두 지원하기 위해 6+ 및 사전 I& # 39 에서 애플은 이 같은 일이 있는 코드를 사용하는 것이 좋습니다; d '' apiu 마크마피템 doc 페이지:
Class itemClass = [MKMapItem class];
if (itemClass && [itemClass respondsToSelector:@selector(openMapsWithItems:launchOptions:)]) {
// iOS 6 MKMapItem available
} else {
// use pre iOS 6 technique
}
이는 solaris. 해당 Xcode 기본 SDK 는 iOS 6 (또는 최신값 iOS ).
NSString* addr = [NSString stringWithFormat:@"http://maps.google.com/maps?daddr=Current Location&saddr=%@",startAddr];
NSURL* url = [[NSURL alloc] initWithString:[addr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
[[UIApplication sharedApplication] openURL:url];
[url release];
아이폰 / 아이팟 언어 설정되었습니다 입성하는 것은 이 작품을 영어로. 다른 언어를 사용할 수 있도록 지원하기 위해 스케쳐내 you& # 39, ll %s/dbase/ext_table. 관찰지역 문자열이어야 매핑하므로 일치시킵니다 책갈피 이름.
이 기능은 아이폰.
>. [http://maps.google.com/maps? = 현재 Location& 사데르 다드르 = 123 주, St, 오타와, 켜짐이] [1]
[1]: http://maps.google.com/maps =, = 123%20main% 20st, 오타와, 켜짐이 다드르 20location& Current% 사데르?
#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
ios 버전 파악할 수 있습니다. 그럼 내가 지원하기 위해, 고쳐주렴 iOS 6 이 코드를 사용할 수 있습니다.
NSString* addr = nil;
if (SYSTEM_VERSION_LESS_THAN(@"6.0")) {
addr = [NSString stringWithFormat:@"http://maps.google.com/maps?daddr=%1.6f,%1.6f&saddr=Posizione attuale", view.annotation.coordinate.latitude,view.annotation.coordinate.longitude];
} else {
addr = [NSString stringWithFormat:@"http://maps.apple.com/maps?daddr=%1.6f,%1.6f&saddr=Posizione attuale", view.annotation.coordinate.latitude,view.annotation.coordinate.longitude];
}
NSURL* url = [[NSURL alloc] initWithString:[addr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
[[UIApplication sharedApplication] openURL:url];
내가 추천하는 체크아웃하기 사마플라운처 는 iOS 앱을 실행할 수 있는 애플, 구글 등 미니 도서관 내가 구축됨 매핑에서는 sys_memsize 특정 구성도를 요청. 이 코드는 사마플라운처 방향의 얻을 수 있는 질문을 다음과 같습니다.
[CMMapLauncher launchMapApp:CMMapAppAppleMaps
forDirectionsFrom:[CMMapPoint mapPointWithName:@"Origin"
coordinate:myLatLong]
to:[CMMapPoint mapPointWithName:@"Destination"
coordinate:latlong]];
또한 알 수 있듯이, iOS 6 버전 확인 캡슐화합니다 사이에 필요한 &. 한다.
이후 안녕하슈 iOS6 사용할 수 있다!
애플의 놀라운 일을 한 나쁘지 길 (from my point of view).
이러한 방식으로 우리는 그냥 구글 애플은 모든 쿼리하지 문장열 전환하십시오 데브로퍼스 가지고 있는 것으로 나타났다. 이것이 내가 싫어하는 많이유.
그래서 난 오늘 구현하는 그것을했다 펑크티오나로티 했다. 하지만 내가 느꼈던 아니라 모든 모바일 웹 사이트 url # 39 의 매핑하므로 Apple& 재작성할 누워 타겟으로의 서버에 위치시키는 생각해봤죠 I& 서버측 url 및 경배하되 이데비크스 탐지합니다; d # 39 그냥 애플 딱 그. D # 39 생각해봤죠 I& 공유하지는.
그냥 list. '시파드' dtep 방법으로 부울입니다 getter 및 구글, 애플, re 수행됨 you& # 39 에 변환하십시오 너회가 못함; -)
$server=$detect->isiPad()?"apple":"google";
$href="http://maps.{$server}.com/?q=..."
건배!
NSString *destinationAddress = @"Amsterdam";
Class itemClass = [MKMapItem class];
if (itemClass && [itemClass respondsToSelector:@selector(openMapsWithItems:launchOptions:)]) {
CLGeocoder *geocoder = [[CLGeocoder alloc] init];
[geocoder geocodeAddressString:destinationAddress completionHandler:^(NSArray *placemarks, NSError *error) {
if([placemarks count] > 0) {
MKPlacemark *placeMark = [[MKPlacemark alloc] initWithPlacemark:[placemarks objectAtIndex:0]];
MKMapItem *mapItem = [[MKMapItem alloc]initWithPlacemark:placeMark];
MKMapItem *mapItem2 = [MKMapItem mapItemForCurrentLocation];
NSArray *mapItems = @[mapItem, mapItem2];
NSDictionary *options = @{
MKLaunchOptionsDirectionsModeKey:MKLaunchOptionsDirectionsModeDriving,
MKLaunchOptionsMapTypeKey:
[NSNumber numberWithInteger:MKMapTypeStandard],
MKLaunchOptionsShowsTrafficKey:@YES
};
[MKMapItem openMapsWithItems:mapItems launchOptions:options];
} else {
//error nothing found
}
}];
return;
} else {
NSString *sourceAddress = [LocalizedCurrentLocation currentLocationStringForCurrentLanguage];
NSString *urlToOpen = [NSString stringWithFormat:@"http://maps.google.com/maps?saddr=%@&daddr=%@",
[sourceAddress stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding],
[destinationAddress stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlToOpen]];
}
Ios5 대한 올바른 욕금지, 현재 위치에 있어야 합니다. 내가 이 게시물을 (http://www.martip.net/blog/localized-current-location-string-for-iphone-apps) 에서 로카리스트커렌트로카션 사용합니다를
내가 클조코더 ios6 를 사용할 수 있는 장소, 그리고 현재 위치를 정보기술 (it) 과 함께 매핑해야 엽니다.
코레로카션.프라임보크 및 마프키t.프라임보크 추가해야 합니다
애플 docs 추천합니까 iOS6 를 사용하여 구성표가 avamer URL maps.apple.com
그래서 사용
http://maps.apple.com/maps?saddr=%f,%f&daddr=%f,%f
대신
http://maps.google.com/maps?saddr=%f,%f&daddr=%f,%f
하위 호환 될 수 있는 코드
NSString* versionNum = [[UIDevice currentDevice] systemVersion];
NSString *nativeMapScheme = @"maps.apple.com";
if ([versionNum compare:@"6.0" options:NSNumericSearch] == NSOrderedAscending)
nativeMapScheme = @"maps.google.com";
}
NSString* url = [NSString stringWithFormat: @"http://%@/maps?saddr=%f,%f&daddr=%f,%f", nativeMapScheme
startCoordinate.latitude, startCoordinate.longitude,
endCoordinate.latitude, endCoordinate.longitude];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
완전히 다른 로드하십시오 매개 변수를 사용할 수 있을 지도 uirl 구성표가: 애플 uirl 구성표가 참조
이러한 조건 코드 탐지 매크로 iOS 버전을 사용할 수 있는 경우 다른 지역에서도 코드에. iOS 버전 매크로
진짜 솔루션이므로 여기에서 찾을 수 있습니다. Z5 개념 iOS 개발 코드 스니핏
그냥 조금 单捞磐啊 인코딩입니다.
- (IBAction)directions1_click:(id)sender
{
NSString* address = @"118 Your Address., City, State, ZIPCODE";
NSString* currentLocation = @"Current Location";
NSString* url = [NSStringstringWithFormat: @"http://maps.google.com/maps?saddr=%@&daddr=%@",[currentLocation stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding],[address stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
UIApplication *app = [UIApplicationsharedApplication];
[app openURL: [NSURL URLWithString: url]];
}
그냥 지금 할 수 있는 html 의 url 에서 mobile device 에 그쳤다. # 39 에 있는 [예] [1] here&. 이 경우 qr 코드 붙여넣습니다 선반가공 것은 멋진 사람이 어디에 있든 그들은 방향을 가져오는 방법이 있습니다.) 에서 너회들 스캐만을 것만으로 it 관련 휴대전화요
[1]: http://maps.google.com/maps/m - z = 13& 116.198677&, ll, dc = mgc_maps # 43.600113? = = = =;;; 사데르 My% 20location& 다드르 1910%20university% 20dr% 20boise% 20id& 티퍼 dep& 디르플그 = = = =;;;; 보기 d& map& l 보기 map& l lci m, t, l, com.google.latitudepublicupdates&, ac =
Ios6 위한 애플리케이션 (앱) 을 사용하여 동일한 url 위에 게시하기를 매핑하므로 됩니다 ',' (http://maps.google.com/maps) =, = %@ 다드르 %f& %f 사데르?
그러나 url 을 (를) '대신' 그 결과 다음, 구글 맵스 url 을 사용하면 maps:// url: ',' 다드르 %f& %f maps://saddr =, = %@.
안토서 하느님. # 39 의 하위 호환 it&. Ios5 정보기술 (it) 에서 시작하여, 구글 지도 app.
현재 버전의 구글 맵스, 단순히 '이' 사드르 생략하십시오 매개변수입니다:
>. '사데르': 사용자의 현재 위치를 경우 이 값은 공백으로 관심용 사용됩니다.
https://developers.google.com/maps/documentation/ios/urlscheme
Ios 로페냉구그레마프스 을 사용하여 내 제안에 약간만이라도 ldmf 는 최신임 선택 (오는 11월 2015년) 를 지원하며, 코코아 포드 설치 및 단 몇 번의 클릭만으로 준비가 되어 있습니다.
설치 방법: ',' 포드 " OpenInGoogleMaps".
에 필요한 헤더 파일 사용: ',' # 가져오기의 " OpenInGoogleMapsController.h".
샘플 코드 (아래 참조).
/*In case the user does NOT have google maps, then apple maps shall open*/
[OpenInGoogleMapsController sharedInstance].fallbackStrategy = kGoogleMapsFallbackAppleMaps;
/*Set the coordinates*/
GoogleMapDefinition *definition = [[GoogleMapDefinition alloc] init];
CLLocationCoordinate2D metsovoMuseumCoords; //coordinates struct
metsovoMuseumCoords.latitude = 39.770598;
metsovoMuseumCoords.longitude = 21.183215;
definition.zoomLevel = 20;
definition.center = metsovoMuseumCoords; //this will be the center of the map
/*and here we open the map*/
[[OpenInGoogleMapsController sharedInstance] openMap:definition];
이제 다드르 =\ (데스티나션로카션드라티스우드), http://maps.apple.com/maps? = " 우얼스트링 (데스티나션로카션.롱기트우드) = d" 디르플그 &; }
이아프리카션.샤레트리오픈우를 (URL (문자열. 우얼스트링)!)
내가 다른 스레드에 대해 이렇게 답했다. ([현재 위치, t # 39 작동합니까 매핑하므로 doesn& 애플 IOS 6] [1]). 현재 위치 좌표를 내려받습니다 합니다 먼저 uirl 매핑해야 만드는 데 사용한다.
[1]: # 14272263 https://stackoverflow.com/questions/12539009/current-location-doesnt-work-with-apple-maps-ios-6/14272263