使用解析获取错误(代码:105,版本:1.17.2)

Getting Error (Code: 105, Version: 1.17.2) with parse

我正在尝试使用 Parse 将数据保存到我的数据库中,但每次我 运行 代码都会出现以下错误

[Error]: Invalid field name: name. (Code: 105, Version: 1.17.2)

我已经尝试从名称中删除空格,但仍然出现错误

   override func viewDidLoad() {
       super.viewDidLoad()

       let person = PFObject(className: "People")
       person.add("dee", forKey: "name")
       person.add("odus", forKey: "last_name")
       person.add(36, forKey: "age")

       person.saveInBackground()
   }

我希望它保存在我的数据库中

尝试:

   override func viewDidLoad() {
       super.viewDidLoad()

       let person = PFObject(className: "People")
       person["name"] = "dee"
       person["last_name"] = "odus"
       person["age"] = 36

       person.saveInBackground()
   }

参考:https://docs.parseplatform.org/ios/guide/#saving-objects

我刚刚尝试使用@Davi Macêdo 的代码手动安装 XCode 10.3 和 Parse 1.17.2。 必须包括这些框架:

CFNetwork.framework
CoreGraphics.framework
CoreLocation.framework
libz.1.1.3.dylib
MobileCoreServices.framework
QuartzCore.framework
Security.framework
StoreKit.framework
SystemConfiguration.framework

它奏效了。

在尝试 .add 方法时,我在自动完成中收到有关 .add 方法的消息:

Adds an object to the end of the array associated with a given key

我无法将其保存到现有的 Person class,但能够将其保存为新 class 中的数组 我调用了 Test

所以,@Davi Macêdo 的代码似乎是正确的,您误用了 .add 方法。 它在我的测试 class 上起作用,因为它还没有任何列,所以它创建了一个名称 属性 作为数组,年龄 属性 作为数组和 last_name 属性作为另一个数组。 你的可能没有用,因为你已经有一些数据作为字符串。

请检查。