无法使用索引类型为“String!”的类型'[String:PFFile]'下标值

时间:2016-04-22 23:48:54

标签: ios swift parse-platform

我已经声明了一个全局变量'var recipes = String:PFFile'。

在parse.com上,我创建了一个名为“recipe”的列,类型为File,我已经上传了包含食谱的.txt文件。

我正在尝试将.txt文件的内容从解析加载到UITextView。

我尝试过很多东西,这就是我所拥有的:

let recipeFile = object["recipe"] as! PFFile
recipeFile.getDataInBackgroundWithBlock({ (recipeData, error) -> Void in


     if error == nil {

         let data = recipeData

     } else {

         print(error)

     }

     if let data = recipeData {

         self.recipes[appetizerName] = PFFile(data: data)

         // gives error: Cannot subscript a value of type '[String : PFFile]' with an index of type 'String!'
         //   self.myTextView.text = self.recipes[self.valuePassed]

     }

 })

0 个答案:

没有答案