转换为ABSearchComparison

转换为ABSearchComparison

本文介绍了Swift _ABSearchComparison不能转换为ABSearchComparison的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我是编程和Swift的新手,我对通讯录的搜索感到困惑.

Hi I am very new to programming and Swift and I am stuck with the search of the Address Book.

我收到此错误:_ABSearchComparison无法转换为ABSearchComparison

I get this error: _ABSearchComparison is not convertible to ABSearchComparison

var adbk = ABAddressBook.sharedAddressBook()

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

先谢谢您

推荐答案

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

kABEqual has the type struct _ABSearchComparison and must thereforeby converted explicitly to an ABSearchComparison (aka CFIndex),as expected by the comparison: parameter:

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

这篇关于Swift _ABSearchComparison不能转换为ABSearchComparison的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-07 20:08