ios - 在 Xcode Beta 6 之后快速使用 NSPredicate 崩溃

标签 ios crash swift nspredicate xcode6-beta6

我的代码在 Xcode beta 5 中运行良好,但在下载 beta 6 后,它崩溃了。

这是我的代码:

extension String {

    /**
    * http://stackoverflow.com/questions/3139619/check-that-an-email-address-is-valid-on-ios
    */
    func isValidEmail() -> Bool {
        let emailRegex = ".+@([A-Za-z0-9-]+\\.)+[A-Za-z]{2}[A-Za-z]*";
        let emailTest = NSPredicate(format: "SELF MATCHES %@",emailRegex);
        return emailTest.evaluateWithObject(self);
    }
}

执行时,它在 NSPredicate 行崩溃:

let emailTest = NSPredicate(format: "SELF MATCHES %@",emailRegex);

有人知道这个问题吗?

最佳答案

尝试删除派生数据然后重建,这个方法解决了我的问题!

~/Library/Developer/Xcode/DerivedData/

关于ios - 在 Xcode Beta 6 之后快速使用 NSPredicate 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25511879/

相关文章:

ios - iOS 拍摄应用程序快照时崩溃

c++ - 如果它们发生在 Qt 中,我可以得到断言的名称吗?控制台应用程序

ios - #警告: C-style for statement is deprecated and will be removed in a future version of Swift

ios 非对话 Facebook 分享失败,没有错误,也没有反馈

ios - 重新排列数组中的字母并检查排列是否在数组中

android - 我再次遇到来自 android 中的eekbar 的 NullPointerException

swift - 根据数组中的项目数迭代创建 UITextView

ios - 移至自定义 UItableViewCell 中的下一个 UItextfield(具有多个部分的 Tableview)

ios - 创建类似于 Facebook 提要页面的应用

ios - 设置 UILongPressGesture 的最大持续时间?