ios - 从 1.1 升级到 1.2 后出现奇怪的快速错误

标签 ios objective-c xcode swift

更新之前我的项目在 swift 1.1 和 Xcode 6.1.1 上运行良好。我刚刚升级到 swift 1.2 并在我的 AppDelegate 中遇到一个奇怪的错误

 func application(application:UIApplication, didReceiveRemoteNotification userInfo:NSDictionary)

并且还在从 UITextFieldDelegate 派生的类中

func textFieldDidBeginEditing(textField: UITextField!) -> Bool // called textfield for locationField clicked

顺便说一句

Objective-C method 'application:didReceiveRemoteNotification:' provided by method 'application(:didReceiveRemoteNotification:)' conflicts with optional requirement method 'application(:didReceiveRemoteNotification:)' in protocol 'UIApplicationDelegate'

textFieldDidBeginEditing 的错误是相同的:

Objective-C method 'textFieldDidBeginEditing:' provided by method 'textFieldDidBeginEditing' conflicts with optional requirement method 'textFieldDidBeginEditing' in protocol 'UITextFieldDelegate'

问题是什么?

最佳答案

只需重写方法名称(应该自行修复),然后复制/粘贴方法中的代码。这应该有效。

关于ios - 从 1.1 升级到 1.2 后出现奇怪的快速错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28785196/

相关文章:

ios - 找不到没有标识符的转场

ios - 当我使用 UIImagePNGRepresentation 或 UIImageJPEGRepresentation 将 UIImage 转换为 NSdata 时,图像大小增加太多

ios - 我们能以某种方式在 xcode 模拟器中自定义 RAM 大小吗

ios - 将 AVPlayerViewController 背景更改为专辑封面 objective-c iOS

ios - 滚动tableview时编辑导航栏的alpha

ios - Xcode 错误 - UIView 中的预期声明

ios - 沿途发送的多点连接和数据

objective-c - UITableView 作为 AppDelegate 中的 subview

objective-c - Objectivc C 保留层的上下文

ios - 在 xcode 中实现登录屏幕后滑出菜单栏