# wx.chooseAddress(Object object)

> 基础库 1.1.0 开始支持，低版本需做[兼容处理](1003706)。

> __以 [Promise 风格](/miniprogram/dev/framework/app-service/api.md#异步-API-返回-Promise) 调用__：支持
> 
> __小程序插件__：支持，需要小程序基础库版本不低于 [2.16.1](1003706)
> 
> __微信 Windows 版__：支持
> 
> __微信 鸿蒙 OS 版__：支持

## 功能描述

获取用户收货地址。调起用户编辑收货地址原生界面，并在编辑完成后返回用户选择的地址。
## 使用方法
自 2022 年 7 月 14 日后发布的小程序，若使用该接口，需要在 app.json 中进行声明，否则将无法正常使用该接口，2022年7月14日前发布的小程序不受影响。[具体规则见公告](https://developers.weixin.qq.com/community/develop/doc/000a02f2c5026891650e7f40351c01)
## 申请开通
暂只针对具备与地理位置强相关的使用场景的小程序开放，在小程序管理后台，「开发」-「开发管理」-「接口设置」中自助开通该接口权限。
接口权限申请入口将于2022年3月11日开始内测，于3月31日全量上线。并从4月18日开始，在代码审核环节将检测该接口是否已完成开通，如未开通，将在代码提审环节进行拦截。

## 参数

### Object object

| 属性 | 类型 | 默认值 | 必填 | 说明 |
| ---- | ---- | ------ | -------- | ---- |
| success | function |  | 否 | 接口调用成功的回调函数 |
| fail | function |  | 否 | 接口调用失败的回调函数 |
| complete | function |  | 否 | 接口调用结束的回调函数（调用成功、失败都会执行） |

#### object.success 回调函数
##### 参数

###### Object res

| 属性 | 类型 | 说明 |
| ---- | ---- | ---- |
| userName  | string | 收货人姓名 |
| postalCode  | string | 邮编 |
| provinceName  | string | 国标收货地址第一级地址 |
| cityName  | string | 国标收货地址第二级地址 |
| countyName  | string | 国标收货地址第三级地址 |
| streetName  | string | 国标收货地址第四级地址 |
| detailInfo  | string | 详细收货地址信息（包括街道地址） |
| detailInfoNew  | string | 新选择器详细收货地址信息 |
| nationalCode  | string | 收货地址国家码 |
| telNumber  | string | 收货人手机号码 |
| errMsg  | string | 错误信息 |

## 示例代码

[在开发者工具中预览效果](https://developers.weixin.qq.com/s/024hHnmd772y)
```js
wx.chooseAddress({
  success (res) {
    console.log(res.userName)
    console.log(res.postalCode)
    console.log(res.provinceName)
    console.log(res.cityName)
    console.log(res.countyName)
    console.log(res.detailInfo)
    console.log(res.nationalCode)
    console.log(res.telNumber)
  }
})
```
