맞춤 가이드 만들기
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
이 페이지에서는 맞춤 탐색 환경의 일부로 맞춤 안내를 만들기 위해 따르는 대략적인 단계를 설명합니다.
이 프로세스는 경로 탐색에 설명된 프로세스와 다음과 같이 다릅니다.
- 먼저 독립적으로 탐색 세션을 설정하고 뷰 컨트롤러를 호출하는 대신 세션을 통해 탐색기 인스턴스를 가져옵니다.
- 탐색 이벤트에 응답하고 이를 관리하기 위해 이벤트 리스너를 설정합니다.
GMSNavigationService.createNavigationSession
를 사용하여 탐색 세션을 만들고 setDestination
호출로 탐색을 시작합니다. Google 내비게이션 환경에서 내비게이션 지도 뷰를 통해 내비게이터를 호출하는 경우 GMSNavigationServices
는 UI 인스턴스와 독립적으로 내비게이션 세션에서 이벤트 스트림을 제어하고 수신합니다. 즉, UI 없이 실행하거나 모든 UI 기반 환경에 전달할 수 있습니다. 이 방법을 사용하면 마지막 참조가 삭제될 때까지 탐색 세션이 앱에서 계속 실행됩니다.
- 도로에 스냅된 위치 정보 제공자 설정 경로를 따라 파란색 점이 있는 탐색 뷰를 표시하는 경우와 같이 앱에서 지속적인 위치 모니터링을 하려면 위치 제공자를 사용하세요.
GMSNavigatorListener
프로토콜을 구현하여 자세한 경로 안내를 위한 리스너를 설정합니다. 그런 다음 이 정보를 맞춤 탐색 환경에 필요한 정보로 변환합니다. 예를 들면 다음과 같습니다.
- 간단한 길안내 화면 전송을 위해 텍스트 전용 필드를 구현합니다.
- 자체 UI의 필드를 설계하고 채웁니다.
- 탐색 시뮬레이터를 설정합니다. 이는 개발 및 테스트에 필요합니다.
독립 탐색 세션 만들기
데모의 다음 코드 스니펫은 뷰 컨트롤러와 독립적으로 설정된 탐색을 보여줍니다. 그런 다음 코드는 현재 도로에 스냅된 위치를 표시하도록 구성된 개요 지도를 추가합니다.
// Create the navigation session.
_navigationSession = [GMSNavigationServices createNavigationSession];
GMSRoadSnappedLocationProvider *roadSnappedLocationProvider =
_navigationSession.roadSnappedLocationProvider;
[roadSnappedLocationProvider startUpdatingLocation];
GMSNavigator *navigator = _navigationSession.navigator;
[navigator addListener:self];
navigator.voiceGuidance = GMSNavigationVoiceGuidanceSilent;
navigator.sendsBackgroundNotifications = NO;
_navigationSession.started = YES;
[navigator setDestinations:@[ destination ]
callback:^(GMSRouteStatus routeStatus) {
// …handle changes in route status.
}];
// Add an overview map.
_mapView = [[GMSMapView alloc] initWithFrame:CGRectZero];
[self.mainStackView addArrangedSubview:_mapView];
[self.mainStackView setNeedsLayout];
_mapView.settings.compassButton = YES;
_mapView.delegate = self;
_mapView.myLocationEnabled = YES;
_mapView.roadSnappedMyLocationSource = roadSnappedLocationProvider;
맞춤 환경에서 Google 환경으로 탐색 전달
이 코드 스니펫은 앱에서 사용자가 맞춤 탐색 환경에서 Google 탐색 환경으로 이동하도록 허용하는 방법을 보여줍니다. 이 코드 스니펫은 앱이 지도를 공유하는 동안 이러한 전환을 수행하는 방법도 보여줍니다.
`UIButton *button = [UIButton buttonWithType:UIButtonTypePlain`];
[`button addTarget:self action:@selector(didTapEnterGoogleNavigationButton:)
forControlState:[_directionsButton addTarget:self`];
`…`
[`_mapView enableNavigationWithSession:_navigationSession`];
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-09-04(UTC)
[null,null,["최종 업데이트: 2025-09-04(UTC)"],[[["\u003cp\u003eCreate custom turn-by-turn navigation experiences on iOS by establishing an independent navigation session using \u003ccode\u003eGMSNavigationServices\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eImplement the \u003ccode\u003eGMSNavigatorListener\u003c/code\u003e protocol to receive and utilize detailed guidance information for your custom UI elements.\u003c/p\u003e\n"],["\u003cp\u003eUtilize a road-snapped location provider for continuous location updates and accurate positioning on the route.\u003c/p\u003e\n"],["\u003cp\u003eSet up a navigation simulator for development and testing purposes to ensure the functionality of your custom navigation experience.\u003c/p\u003e\n"],["\u003cp\u003eTransition seamlessly from a custom navigation experience to the full Google Maps navigation experience, optionally sharing the existing map instance.\u003c/p\u003e\n"]]],["The core process involves creating a navigation session independently using `GMSNavigationService.createNavigationSession`, distinct from route navigation. A road-snapped location provider is established for continuous monitoring. Implement `GMSNavigatorListener` to set up turn-by-turn guidance, translating the information into your app's custom navigation UI. Set up a navigation simulator for testing. The navigation session persists until the last reference is removed. A custom experience can also be transition to the default google navigation experience.\n"],null,["# Create customized guidance\n\nThis page covers the high-level steps you follow to create customized guidance\nas part of a [custom navigation\nexperience](/maps/documentation/navigation/ios-sdk/intro-custom-nav). \n**This process differs from the process described in\n[Navigate a\nroute](/maps/documentation/navigation/ios-sdk/route) as follows:**\n\n- You first establish a navigation session independently and obtain a navigator instance through the session rather than by calling the view controller.\n- You set up an event listener to respond to and manage navigation events.\n\n1. **Create a navigation session** using [`GMSNavigationService.createNavigationSession`](/maps/documentation/navigation/ios-sdk/reference/objc/Classes/GMSNavigationServices#+createnavigationsession) and begin navigation with a `setDestination` call. Where the Google navigation experience invokes the navigator through the navigation map view, the `GMSNavigationServices` controls and receives a stream of events from a navigation session *independently* from a UI instance. This means it can either run without a UI, or get passed to *any* UI-based experience. With this approach, the navigation session continues to run in your app until the last reference is removed from it.\n2. **Establish a road-snapped location provider**. Use the location provider if you want your app to have continuous location monitoring, such as when displaying a navigation view with a blue dot along the route.\n3. **Set up a listener for detailed turn-by-turn guidance** by implementing the `GMSNavigatorListener` protocol. Then, transform that information into whatever is needed for your custom navigation experience. For example:\n 1. Implement text-only fields for simple screen casting of directions.\n 2. Design and populate fields for your own UI.\n4. **Set up a navigation simulator**. This is necessary for development and testing.\n\nCreate an independent navigation session\n----------------------------------------\n\nThe following code snippet from the demo shows navigation established\nindependently from the view controller. The code then adds an overview map\nconfigured to show the current road-snapped location. \n\n // Create the navigation session.\n\n _navigationSession = [GMSNavigationServices createNavigationSession];\n GMSRoadSnappedLocationProvider *roadSnappedLocationProvider =\n _navigationSession.roadSnappedLocationProvider;\n [roadSnappedLocationProvider startUpdatingLocation];\n GMSNavigator *navigator = _navigationSession.navigator;\n [navigator addListener:self];\n navigator.voiceGuidance = GMSNavigationVoiceGuidanceSilent;\n navigator.sendsBackgroundNotifications = NO;\n _navigationSession.started = YES;\n [navigator setDestinations:@[ destination ]\n callback:^(GMSRouteStatus routeStatus) {\n // ...handle changes in route status.\n }];\n\n // Add an overview map.\n _mapView = [[GMSMapView alloc] initWithFrame:CGRectZero];\n [self.mainStackView addArrangedSubview:_mapView];\n [self.mainStackView setNeedsLayout];\n _mapView.settings.compassButton = YES;\n _mapView.delegate = self;\n _mapView.myLocationEnabled = YES;\n _mapView.roadSnappedMyLocationSource = roadSnappedLocationProvider;\n\nPassing navigation from a custom experience to the Google experience\n--------------------------------------------------------------------\n\nThis code snippet illustrates how your app can allow the user to enter the\nGoogle navigation experience from a custom navigation experience. This code\nsnippet also shows how your app makes this transition while sharing the map. \n\n `UIButton *button = [UIButton buttonWithType:UIButtonTypePlain`];\n\n [`button addTarget:self action:@selector(didTapEnterGoogleNavigationButton:)\n forControlState:[_directionsButton addTarget:self`];\n\n `...`\n\n [`_mapView enableNavigationWithSession:_navigationSession`];"]]