我无法获取我存储的数据......这是代码:
if ([string isEqualToString:@""]) {
//RECUPERO DATA
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *pathToDocuments=[paths objectAtIndex:0];
pathToDocuments=[pathToDocuments stringByAppendingString:@"getSubscriptionsListShowOnlyWithUnreadFeeds.txt"];
NSLog(pathToDocuments);
dataReply=[[NSData alloc] initWithContentsOfFile:pathToDocuments];
NSString *string = [[NSString alloc] initWithData:dataReply encoding:NSASCIIStringEncoding];
NSLog(@"string recuperata %@",string);
}
if ([string isEqualToString:@""]==NO) {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *pathToDocuments=[paths objectAtIndex:0];
pathToDocuments=[pathToDocuments stringByAppendingString:@"getSubscriptionsListShowOnlyWithUnreadFeeds.txt"];
NSLog(pathToDocuments);
[dataReply writeToFile:pathToDocuments atomically:YES];}
有什么不对?
编辑
没有错误没有崩溃,但NSLog(@"string recuperata %@",string);
打印一个空字符串!(数据存储在设备中,因为当字符串时我至少运行了一次我的应用程序!= 空谢谢