且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用parse和iOS SDK检索相关数据

更新时间:2023-12-03 13:54:10

我假设您使用的是PFQueryTableViewController,因为方法queryForTable属于该方法.指出查询已在进行中的错误是因为PFQTVC在后台触发了查询,因此在您的情况下无法进行findObjectsInBackgroundWithBlock回答.

I assume you are using a PFQueryTableViewController, as the method queryForTable belongs to that. The error stating that a query is already in progress is because the query is fired behind the scenes by the PFQTVC, so the answer asking to do a findObjectsInBackgroundWithBlock is not possible in your case.

使用此特殊的表视图控制器,还向cellForRowAtIndexPath传递了PFObject,这是与行匹配的对象.

With this special table view controller, the cellForRowAtIndexPath is also passed a PFObject, which is the object to matching the row.

要获取来自相关对象的城市名称,请在cellForRowAtIndexPath中使用以下代码:

To get the city name, which is from related object, you use this code in cellForRowAtIndexPath:

PFObject *city = object[@"origin-city"];
[cell.textLabel setText:city[@"name"]; // The name column from the City class