我有一个PHP
Web 服务,它返回一个JSON
具有这种格式的字符串:
[{"latitud":"37.995914","longitud":"-1.139705","nombre":"Miguel de
Unamuno"},{"latitud":"37.995433","longitud":"-1.140143","nombre":"Calle
Pina"},{"latitud":"37.99499","longitud":"-1.140361","nombre":"Calle
Moncayo"},{"latitud":"37.993918","longitud":"-1.139392","nombre":"Calle
Moncayo2"},{"latitud":"37.994588","longitud":"-1.138543","nombre":"Calle
Salvador de Madriaga"}]
在我的项目中,我有一个具有下一个结构的自定义类:
#import <Foundation/Foundation.h>
#import <MapKit/MapKit.h>
@interface PCoordenada : NSObject
@property (nonatomic) CLLocationCoordinate2D *punto;
@property (nonatomic,strong) NSString *nombre;
@end
然后,我在主应用程序中使用其他类:
#import <UIKit/UIKit.h>
#import "PCoordenada.h"
@interface TestViewController : UIViewController
@property (nonatomic,strong) NSData * HTTPResponse;
@property (nonatomic,strong) NSDictionary * dic;
@property (nonatomic,strong) NSMutableArray *arrayCoord;
@property (nonatomic,strong) PCoordenada *coor;
-(IBAction)GetDataFrom:(id)sender;
@end
我想知道如何制作包含 JSON 字符串信息的 PCoordenada 对象数组。
任何人都可以帮助我吗?
提前致谢 :)