Ios 从NSU字典访问PFUser
我正在尝试检索NSDictionary中的Ios 从NSU字典访问PFUser,ios,objective-c,iphone,forms,parse-platform,Ios,Objective C,Iphone,Forms,Parse Platform,我正在尝试检索NSDictionary中的PFUser,但运行代码时无法检索任何数据。提供的字典中的PFUser是用户密钥。以下是我的输出: // My dictionary { hours = "10 Hours"; location = j; notes = h; title = j; user = "<PFUser: 0x7fea4d578d90, objectId: h1WOITDkrF, localId: (null)> {\n
PFUser
,但运行代码时无法检索任何数据。提供的字典中的PFUser是用户密钥。以下是我的输出:
// My dictionary
{
hours = "10 Hours";
location = j;
notes = h;
title = j;
user = "<PFUser: 0x7fea4d578d90, objectId: h1WOITDkrF, localId: (null)> {\n email = \"XXXXX@yahoo.com\";\n fullName = Pradyumn;\n username = Prnk281;\n }";
}
// Should be displaying the PFUser objectId displays null
2015-12-03 22:11:24.774 XXXXX[16176:816409] User ID: (null)
当您进行查询以获取此数据时,只需在查询中添加一行即可
[query includeKey:@"YOUR COLUMN NAME"];
您将在当前词典中获得用户的所有详细信息。请尝试此操作。我通过以下两条注释解决了我的答案 首先,我检查我的selectedUser是否为可用值,它是:
NSLog(@"Selected user : %@",selectedUser);
然后我按照@paulw11所说的做了,并使用了
selectedUser.objectId
在从selectedUser获取objectId之前,您应该使用selectedUser.objectId
,为什么不在控制台中打印selectedUser,以确保selectedUser具有值。执行NSLog(“选定用户:%@”,选定用户);(只是为了确保价值)
NSLog(@"Selected user : %@",selectedUser);