Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/120.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 如何获取一个具有所有属性的PFObject';一次过创建字段和相关对象?_Ios_Parse Platform - Fatal编程技术网

Ios 如何获取一个具有所有属性的PFObject';一次过创建字段和相关对象?

Ios 如何获取一个具有所有属性的PFObject';一次过创建字段和相关对象?,ios,parse-platform,Ios,Parse Platform,我有一个PFObjects的NSArray,希望一次性获取与该数组中的对象相关的所有数据,因此以后不需要再调用parse。我该怎么做呢?据我所知,你的问题可能是- PFQuery *query = [PFQuery queryWithClassName:@"CLASS_NAME"]; [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) { if (!error &&

我有一个
PFObjects
NSArray
,希望一次性获取与该数组中的对象相关的所有数据,因此以后不需要再调用parse。我该怎么做呢?

据我所知,你的问题可能是-

 PFQuery *query = [PFQuery queryWithClassName:@"CLASS_NAME"];

[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error)
 {
     if (!error && objects.count != 0)
     {
         NSLog(@"Successfully retrieved: %@", objects);

         for(int i=0; i< objects.count; i--)
         {
             NSDictionary *dict = [objects objectAtIndex:i];
             self.label = [dict objectForKey:@"PROPERTY_KEY"]; //Just example

 /* Also modify this code as per you want to fetch properties of some or all */
 /* Do as you want to with properties and also change key as per need of column/property you want */
         }
     }
 }];
PFQuery*query=[pfqueryquerywithclassname:@“CLASS_NAME”];
[查询findObjectsInBackgroundWithBlock:^(NSArray*对象,NSError*错误)
{
如果(!error&&objects.count!=0)
{
NSLog(@“成功检索:%@”,对象);
对于(int i=0;i

通过这种方式,您可以获取数组,也可以根据需要获取数据。

您可以使用PFObject的方法系列:

+(void)fetchAll:(NSArray*)objects

查看关于这些方法的PFObject文档:

我的答案是假设您想要的数组包含在PFObject中。您可以查询此对象并使用include键包含该键中包含的数组

    PFQuery *query = [PFQuery queryWithClassName:@"<object's class name>"];
    [query whereKey:@"objectId" equalTo:object.objectId];
    [query includeKey:@"<array key>"];
PFQuery*query=[pfqueryqueryquerywithclassname:@”
   [query includeKey@"<array key>.<pointer in object from array key>"];
   [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error){
        if(error){
            // handle error
        }else{
            if([objects count] > 0){

                PFObject *object = objects[0]; // Only one matching object to query
                NSArray *array = object[@"<array key>"]; // Array you want
            }
        }
    }];