对象仅在添加到NSMutableArray时存储一个属性

时间:2013-10-24 22:04:29

标签: ios objective-c nsmutablearray

我正在尝试将位置对象(标题,描述,CLLocation)存储在NSMutableArray中,但是只有描述被添加到数组中。所有属性都可用,但只有描述文本被添加到数组而不是对象。我做错了什么?

        NSMutableArray *locArray= [[NSMutableArray alloc]init];
        ...

        NSLog(@"myLoc : %@", myLoc);
        NSString *title = myLoc [@"title"];
        NSString *desc = myLoc [@"description"]; 
        PFGeoPoint *geoPoint = [[PFGeoPoint alloc]init];
        geoPoint = [myLoc objectForKey:@"location"];//location; 
        NSLog(@"GEO POINT : %f", geoPoint.latitude);


        PDLocation *PDLoc = [[PDLocation alloc]initWithName:title description:desc andLocation:CLLocationCoordinate2DMake(geoPoint.latitude, geoPoint.longitude)];
        NSLog (@"PDLOC : %@", PDLoc.name);
        NSLog (@"PDLOC : %@", PDLoc.description);
        NSLog (@"PDLOC : %f", PDLoc.location.latitude);
        [locArray addObject:PDLoc] ;

0 个答案:

没有答案