ios - Swift 返回错误 'Binary operator == cannot be applied to two EKSourceType operands'

标签 ios swift ios8

我在 Xcode 6.3 中有这样的代码:

let store = EKEventStore()

for source in store.sources() {
    let st: EKSourceType = source.sourceType!
    if st == EKSourceTypeLocal {
        localSource = source;
    }
}

第五行(如果 st..)给出了编译器错误:“二元运算符 == 不能应用于两个 EKSourceType 操作数”

我如何检查源代码是否是本地的(在 Swift 中)并编译它?

最佳答案

像这样:

if st.value == EKSourceTypeLocal.value

关于ios - Swift 返回错误 'Binary operator == cannot be applied to two EKSourceType operands',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29800562/

相关文章:

ios - 将链接语法转换为嵌入在文本 UITextView 中的链接

ios - RxSwift - 当 UITextField 以编程方式更新时,UILabel 字段未更新

ios - SwiftUI 平移手势

ios - UIPageViewController 下一个按钮

ios - 在 iOS 8 上调整 UIModalPresentationFormSheet 的大小

ios - 任何人都可以解释如何正确添加约束到导航栏按钮或者这段代码有什么问题吗?

swift - Xcode 居中图像,同时保持正方形

ios - 保存位置时我应该在数据库中存储哪些具体数据

ios8 - InputAccessoryView 不显示在 iOS 8 模拟器上

ios - 在 iOS 8 自定义键盘中显示建议栏