I have been working on an Enterprise distributed application for the iPad for about a year. We have released 5 production builds in that time and never experienced any issues. Every time our users have installed the new build over the old version, and our Core Data migrations always worked fine. UNTIL we added video recording to the application.
We had been storing 'Media' in the Core Data Externally Managed data type. This was working fine until we started to allow the user to create large videos. So we then discovered that Core Data migrations trash any file that is over ~5mb. At this point we rolled our own File Management scheme. This worked out perfectly fine, we wrote our own manual migration of the files out of Core Data and into our own scheme. This was released without issue.
THEN, when it came time to roll out our NEXT set of features, suddenly a problem popped up. There were never any issues when building from Xcode... But, after redeploying using Enterprise Deployment, any of the files that were written to the filesystem in the previous build were suddenly unreadable. If a device is plugged into XCode, the files are clearly visible in the Organizer. However NSFileManager/NSFileHandle/NSData can not find the files. They always report that they experience:
error: {
NSFilePath = "/var/mobile/Applications/3CFB07B3-D17F-45D7-A233-4E56930D794C/Documents/ep_binary_data/9465C282-7ED2-428E-B7D3-545BCFE4DFC5";
NSUnderlyingError = "Error Domain=NSPOSIXErrorDomain Code=2 \"The operation couldn\U2019t be completed. No such file or directory\"";
}
Like I said, I can verify that the file DOES ACTUALLY EXIST at that path using the XCode Organizer. Any help would be greatly appreciated. I have been banging my head off the desk all day trying to figure this out.
The code used to read looks like:
NSError *err = nil;
NSData *data = [[NSData alloc] initWithContentsOfFile:self.thumbnail_url
options:NSDataReadingMappedIfSafe
error:&err];
if (err != nil) logger(@"error: %@",[err userInfo]);
And to write:
NSError *error = nil;
[thumbnail_ep_managed writeToFile:filePath options:NSDataWritingAtomic error:&error];
if(error != nil)
{
NSLog(@"error writing file to path: %@\nerror: %@",filePath,[[error userInfo]description]);
}
I'm stumped