Appdelegate.m中代码:
NSFileManager *fileManager = [NSFileManager defaultManager];
NSURL *containerUrl = [fileManager containerURLForSecurityApplicationGroupIdentifier:@"group.com.xxx.share"];
NSString *newPath = [containerUrl.path stringByAppendingPathComponent:@"Library/Caches"];
NSError *error = nil;
NSArray *fileList = [[NSArray alloc] init];
//fileList便是包含有该文件夹下所有文件的文件名及文件夹名的数组
fileList = [fileManager contentsOfDirectoryAtPath:newPath error:&error];
NSLog(@"Every Thing in the dir:%@",fileList);
// App写入共享空间
NSDictionary *dictttt =@{@"launchOptions":@"1"};
NSString *launchOptionsPath = [newPath stringByAppendingPathComponent:@"launchOptions.plist"];
[dictttt writeToFile:launchOptionsPath atomically:YES];
NSLog(@"[WPushLog]:launchOptionsPath :%@", launchOptionsPath);
// 读取Service写入
NSString *filePathName = [newPath stringByAppendingPathComponent:@"pushFile.plist"];
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:filePathName];
NSLog(@"读取共享空间文件:%@", dict);
NotificationService.m
NSFileManager *fileManager = [NSFileManager defaultManager];
NSURL *containerUrl = [fileManager containerURLForSecurityApplicationGroupIdentifier:@"group.com.wchat.share"];
NSString *newPath = [containerUrl.path stringByAppendingPathComponent:@"Library/Caches"];
NSError *error = nil;
NSArray *fileList = [[NSArray alloc] init];
//fileList便是包含有该文件夹下所有文件的文件名及文件夹名的数组
fileList = [fileManager contentsOfDirectoryAtPath:newPath error:&error];
NSLog(@"Every Thing in the dir:%@",fileList);
// Service写入文件
NSString *filePathName = [newPath stringByAppendingPathComponent:@"pushFile.plist"];
[customInfoGDict writeToFile:filePathName atomically:YES];
NSLog(@"[WPushLog]:filePathName :%@", filePathName);
// 读取App写入文件
NSString *launchOptions = [newPath stringByAppendingPathComponent:@"launchOptions.plist"];
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:launchOptions];
NSLog(@"[WPushLog]:launchOptions :%@", dict);