ios - (NSObject, AnyObject) 不可转换为 DictionaryIndex<NSObject, AnyObject>

标签 ios swift parse-platform

我正致力于从 Objective-C 教程转换此委托(delegate)协议(protocol)函数,但在尝试通过使用下标返回基于键的值来访问字典中的值时遇到错误。我不太确定这里的错误是什么意思。任何帮助将不胜感激!

// Sent to the delegate to determine whether the sign up request should be submitted to the server
func signUpViewController(signUpController: PFSignUpViewController!, shouldBeginSignUp info: [NSObject : AnyObject]!) -> Bool {
  var informationComplete: Bool = true

  // Loop through all of the submitted data
  for key in info {
    var field: String = info[key] // Error occurs at this line on info
    if field.isEmpty {
      informationComplete = false
      break
    }
  }

  // Display an alert if a field was not completed
  if !informationComplete {
    let alertView: UIAlertView = UIAlertView(title: "Missing Information", message: "Please make sure all information is filled out!", delegate: nil, cancelButtonTitle: "ok")
  }

  return informationComplete
}

最佳答案

您没有发布声明。但您可能可以通过以下方式解决它:

for (key, field) in info {
  if field.isEmpty {
    informationComplete = false
    break
  }
}

关于ios - (NSObject, AnyObject) 不可转换为 DictionaryIndex<NSObject, AnyObject>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27747173/

相关文章:

ios - 从容器 View 内的 TableView 单元格进行 Segue 不起作用

ios - RSS 提要核心数据保存在 uitableview 中

ios - Swift - 大标题和搜索栏

ios - PresentViewController 故障排除

java - 与接收 parse.com 推送通知 Android 相关的错误

java - 无法恢复 Activity - NullPointerException

ios - 如何修复 UICollectionView 单元格中的 fatal error ?

ios - 无法将视频保存到照片库

ios - 从单元测试执行时未在控制台中打印 Struct 的说明

ios - 从 Parse 中检索 SAVED objectID