---
name: "chooseLocation"
mode: "kit"
versionRequirements:
  - { name: "MapKit", version: "1.0.6" }
platform:
  - "iOS"
  - "Android"
async: true
title: "ty.map.chooseLocation"
---

## chooseLocation

> [VERSION] MapKit >= 1.0.6

> [PLATFORM] iOS, Android

> ⚡ **Supports Promise** — Returns a Promise when success / fail / complete callbacks are omitted.

### Description

Open the map to choose a location

### Parameters

| Property | Type | Required | Default | Since | Description |
| --- | --- | --- | --- | --- | --- |
| `latitude` | `number` | No | - | `1.0.6` | Target latitude |
| `longitude` | `number` | No | - | `1.0.6` | Target longitude |
| `title` | `string` | No | - | `7.4.0` | Title |
| `detailText` | `string` | No | - | `7.4.0` | Detailed description |
| `complete` | `() => void` | No | - | - | Callback invoked when the API call completes (runs on both success and failure) |
| `success` | `(params: Object) => void` ↓see below | No | - | - | Callback invoked on successful API call |
| `fail` | `(params: Object) => void` ↓see below | No | - | - | Callback invoked on failed API call |

#### success callback parameters

| Property | Type | Since | Description |
| --- | --- | --- | --- |
| `name` | `string` | `3.0.5` | Location name |
| `address` | `string` | `3.0.5` | Detailed address |
| `latitude` | `number` | `3.0.5` | Latitude, float, range -90 to 90; negative values indicate south. Uses the gcj02 coordinate system. |
| `longitude` | `number` | `3.0.5` | Longitude, float, range -180 to 180; negative values indicate west. Uses the gcj02 coordinate system. |

#### fail callback parameters

| Property | Type | Description |
| --- | --- | --- |
| `errorMsg` | `string` | Error message |
| `errorCode` | `string \| number` | Error code |
| `innerError` | `Object` | Error extensions |

##### fail(params).innerError properties

| Property | Type | Description |
| --- | --- | --- |
| `errorCode` | `string \| number` | Extended error code |
| `errorMsg` | `string` | Extended error information |


### Examples

```tsx
ty.map.chooseLocation({
  latitude: 39.908823,
  longitude: 116.39747,
  title: "xx",
  detailText: "xx",
  success: data => {
    console.log(data);
  },
  fail: error => {
    console.error(error);
  },
});
```
