Hi,
I'd like to download a zip file and move the downloaded file using this code snippet:
NSFileManager *fileManager = [NSFileManager defaultManager];
BOOL isDir;
NSString *path = ...;
NSString *targetPath = ...;
NSString *targetDirectory = [targetPath stringByDeletingLastPathComponent];
if (![fileManager fileExistsAtPath:targetDirectory isDirectory:&isDir] && !isDir)
{
NSError *dirError;
if (! [fileManager createDirectoryAtPath:targetDirectory withIntermediateDirectories:YES attributes:nil error:&dirError])
{
NSLog(@"%@", dirError.localizedDescription);
}
}
//...
if ([fileManager moveItemAtPath:path toPath:targetPath error:&error])
{
success = YES;
}It has worked fine on our test devices and it has also worked fine on iOS 8.x. Now, some beta tester have reported that moving the zip file fails on devices with iOS 9.x because the target directory does not exist. Not in general, only on a few devices running iOS 9.x. I have updated our test devices to iOS 9.1 and it still works. The zip file is the same for all test users.
So, what next? It works on our test devices, but not on some others. Does anybody know if there are known bugs in iOS 9.x while creating directories or moving files? Does anybody have any idea what to do here?
Thanks a lot for your response.
Michael