gpt4 book ai didi

ios - 如何在 Parse API 中访问字典数组

转载 作者:行者123 更新时间:2023-11-29 01:21:51 26 4
gpt4 key购买 nike

我将一组字典保存到 Parse,它正确显示在 User 类中。我可以在断点处 po user 并且该数组正确显示为 User 的属性之一。但是,我根本无法访问此数据,我收到运行时错误 EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)。我正在尝试使用 user.userFbFriendsDetail 访问数据以保存到局部变量。这是我 po User 时的控制台结果,我不知道如何使用 userFBFriendsDetail 数组。非常感谢您的帮助!

<PFUser: 0x7fe1dd281010, objectId: onHQnYR5d2, localId: (null)> {
facebookID = xxxxxxx
fbEmail = xxxxxx
fbGender = male;
fbName = "John Doe";
friendsUsingTheApp = (
"<PFUser: 0x7fe1dbd30210, objectId: oqKnKZMN3d, localId: (null)>",
"<PFUser: 0x7fe1dbd30510, objectId: hUNZvZC4fD, localId: (null)>"
);
userFbFriendsDetail = (
{
email = "fake@fake.com";
facebookID = 1111111111;
profileImage = "<PFFile: 0x7fe1dfe28422>";
},
{
email = "fake@fake.com";
facebookID = 222222222222;
profileImage = "<PFFile: 0x7fe1dbd1ffd1>";
}
);
}

编辑:这是 PFUser 类的定义:

class User : PFUser {
override class func initialize() {
struct Static {
static var onceToken : dispatch_once_t = 0;
}
dispatch_once(&Static.onceToken) {

self.registerSubclass()
}
}

@NSManaged var gender: String?
@NSManaged var fbName: String?
@NSManaged var age: NSNumber?
@NSManaged var facebookID: String?
@NSManaged var fbLocale: String?
@NSManaged var fbTimezone: NSNumber?
@NSManaged var fbGender: String?
@NSManaged var fbEmail: String?
@NSManaged var fbAge: NSNumber?
@NSManaged var profileImage: PFFile?
@NSManaged var twitterHandle: String?
@NSManaged var state: String?
@NSManaged var birthday: String?
@NSManaged var friendsUsingTheApp:Array<String>
@NSManaged var userFbFriendsDetailDict:Dictionary<String, AnyObject>
}

最佳答案

userFbFriendsDetailDict应该是 Array<Dictionary<String, AnyObject>> 类型. (您应该以该名称访问它,而不是 userFbFriendsDetail )。

关于ios - 如何在 Parse API 中访问字典数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34503347/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com