从swift 2迁移到swift 3错误

从swift 2迁移到swift 3错误,swift,string,swift3,Swift,String,Swift3,下面的代码在swift 2中运行良好,但在迁移到swift 3后显示错误“调用中缺少参数#1的参数” @IBOutlet weak public var countryTextField: UILabel! var country_code = self.countryTextField.text!.characters.dropFirst() // missing argument for parameter #1 in call 您能发布IBMOutlet countryTextFiel

下面的代码在swift 2中运行良好,但在迁移到swift 3后显示错误“调用中缺少参数#1的参数”

@IBOutlet weak public var countryTextField: UILabel!

var country_code = self.countryTextField.text!.characters.dropFirst() // missing argument for parameter #1 in call

您能发布IBMOutlet countryTextField的声明吗?奇怪-创建了一个带有标签的项目,并运行此代码而没有任何问题。干净构建?@NickCatlib在swift2中运行良好是的,我同意-即使您使用此设置创建新项目,它也会工作。这就是为什么我建议清理然后重新构建错误是误导性的。不能在函数或方法之外运行此代码。