Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/117.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 从NSU字典访问PFUser_Ios_Objective C_Iphone_Forms_Parse Platform - Fatal编程技术网

Ios 从NSU字典访问PFUser

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

我正在尝试检索NSDictionary中的
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);