#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[superviewDidLoad];
[self text];
}
- ( void )touchesBegan:( NSSet < UITouch *> *)touches withEvent:( UIEvent *)event{
- ( void )touchesBegan:( NSSet < UITouch *> *)touches withEvent:( UIEvent *)event{
NSURLRequest * request = [ NSURLRequestrequestWithURL:url];
// 发送请求数据
[[[ NSURLSession sharedSession] dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
NSLog(@"data = %@",[[ NSStringalloc]initWithData:data encoding:NSUTF8StringEncoding]);
NSArray * array1 = [ NSJSONSerializationJSONObjectWithData:data options:0error:NULL];
NSLog(@"%@",array1);
// for (NSDictionary * dict in array1) {
//
// NSLog(@"%@",dict);
// }
}] resume];
}
-( void )text{
-( void )text{
NSString * path = [[ NSBundlemainBundle] pathForResource:@"apps.plist"ofType:nil];
NSArray
* array = [
NSArray
arrayWithContentsOfFile:path];
NSData * data = [ NSJSONSerialization dataWithJSONObject:array options:0error:NULL];
[data writeToFile:@"/Users/zzx/Desktop/arrar.json"atomically:YES];
NSLog(@"写入成功");
}
@end