- (void)viewDidLoad
{
[super viewDidLoad];
NSFileManager * fileManager =[[NSFileManager alloc]init];
NSArray *Apath=[fileManager URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask];
NSString *FilePath=[[Apath objectAtIndex:0] absoluteString];
NSString *TEST =[FilePath stringByAppendingPathComponent:@"test10.txt"];
BOOL flage =[[NSFileManager defaultManager] fileExistsAtPath:TEST];
if (flage)
{
NSLog(@"It's exist ");
}
else
{
NSLog(@"It is not here yet ");
NSData * data =[[NSData alloc]initWithContentsOfURL:[NSURL URLWithString:@"www.google.com"]];
[data writeToFile:TEST atomically:YES];
}
}
I'm just trying to create a text file , it always give me "It is not here yet" Anything wrong with the code ??