gpt4 book ai didi

ios - 为 RideIntent 创建自定义 CLPlacemark

转载 作者:搜寻专家 更新时间:2023-10-30 22:11:11 25 4
gpt4 key购买 nike

我正在尝试使用 Intents 框架创建自定义 CLPlacemark。我在文件开头导入“意图”。

我找到了这个解决方案:

let waypointLocation = CLLocation(latitude: 50.00, longitude: 8.00)
let waypointName = "Some Name"

let w1 = CLPlacemark.init(location: waypointLocation,
name: waypointName,
postalAddress: nil)

不幸的是,上面的代码给我以下错误信息:

Ambiguous reference to member 'init(placemark:)'

有什么问题吗?

文档:

最佳答案

刚刚发现在 iOS 12/Xcode 10 中你还必须包含 Contacts 框架,因为 postaladdress 参数具有此初始化程序所需的类 CNPostalAddress

import Intents
import Contacts

关于ios - 为 RideIntent 创建自定义 CLPlacemark,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43475253/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com