gpt4 book ai didi

macos - Swift _ABSearchComparison 不可转换为 ABSearchComparison

转载 作者:搜寻专家 更新时间:2023-10-31 22:23:05 24 4
gpt4 key购买 nike

您好,我是编程和 Swift 的新手,我一直在搜索地址簿。

我收到此错误:_ABSearchComparison 不可转换为 ABSearchComparison

var adbk = ABAddressBook.sharedAddressBook()

var isGroupBusiness = ABGroup.searchElementForProperty(kABGroupNameProperty, label: nil, key: nil, value: "Business", comparison: kABEqual)

提前谢谢你

最佳答案

kABEqual 具有 struct _ABSearchComparison 类型,因此必须通过显式转换为 ABSearchComparison(又名 CFIndex),正如 comparison: 参数所预期的那样:

var isGroupBusiness = ABGroup.searchElementForProperty(kABGroupNameProperty,
label: nil, key: nil, value: "Business",
comparison: ABSearchComparison(kABEqual.rawValue))

关于macos - Swift _ABSearchComparison 不可转换为 ABSearchComparison,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28479802/

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