本文介绍了从parse.com获取objectId的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我正在构建一个使用解析作为后端的应用程序.我以前写过自己的书,但我想我会节省一些时间并使用解析.我正在用来自解析的数据填充表视图,这很好.我想从通过解析的数组构建的字典中获取objectId.

So I am building an app that uses parse as a backend. I've written my own before but I figured I'll just save some time and use parse. I'm populating a table view with data from parse and that's fine. I want to grab the objectId from an dictionary built from an array from parse.

我的数组的输出如下:

<news_events:pdbIEvOteH:(null)> {\n    eventDescription = \"This is a test description.\";\n    eventMessage = \"This is a test message.\";\n    eventTitle = \"Free Wi-Fi Now Available!\";\n}

在上面的示例中,对象ID为pdbIEvOteH.首先,我尝试使用以下方法获取ID:NSString * objectId = [myDictionary objectForKey:@"objectId"];但是返回空值.我知道字典不是问题,因为我可以获得其他信息.问题是看起来上面的数组中没有objectId的键.如您所见,它紧随news_events.

The object ID is pdbIEvOteH in the example above. I at first tried getting the id by using:NSString * objectId = [myDictionary objectForKey:@"objectId"]; But that returned null. I know it is not a problem with my dictionary because I can get other information. The problem is it looks like there is no key for objectId in the array above. As you can see it follows news_events.

我知道您可以使用PFObject来获取它,但是我不确定是否可以用PFObject填充表.

I know you can get it with the PFObject but I'm not sure if I can populate a table with a PFObject.

所以最重要的是如何获得objectId.

So bottom line is how do I get the objectId.

推荐答案

在我的didSelectRowAtIndexPath:方法中,我执行了以下操作:

In my didSelectRowAtIndexPath: method, I did the following:

PFObject *myObject = [parseArray objectAtIndex:indexPath.row];

NSString *objectId = [myObject objectId];

这篇关于从parse.com获取objectId的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-17 05:20
查看更多