plist反序列化

时间:2023-03-10 05:40:11
plist反序列化

//

//  ViewController.m

//  03-plist文件的一个反序列化

//

//  Created by jerry on 15/9/28.

//  Copyright (c) 2015年 jerry. All rights reserved.

//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {

// 1.URL

NSURL *url = [NSURL URLWithString:@"http://127.0.0.1/videos.plist"];

// 2.请求

NSURLRequest *request = [NSURLRequest requestWithURL:url];

// 3.连接 connection

[NSURLConnection sendAsynchronousRequest:request queue:[[NSOperationQueue alloc]init] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {

id result = [NSPropertyListSerialization propertyListWithData:data options:0 format:NULL error:NULL];

NSLog(@"%@------%@",result,[result class]);

}];

}

@end