在寫入我的iPad中的文件時出現此錯誤。但同樣的應用程序在模擬器中工作正常。我在這裏附上代碼。在向ios中的文件寫入時出錯代碼516
NSString *filepath = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:doc.contentStreamFileName];
NSFileManager *fMngr = [NSFileManager defaultManager];
if ([fMngr fileExistsAtPath:filepath]) {
NSLog(@"File already available");
CMISExtensionElement *elem = [doc.properties.extensions objectAtIndex:0];
NSString *description = [self crop:elem.description];
[self loadImage:doc.contentStreamFileName desc:description];
}
else{
[doc downloadContentToFile:filepath completionBlock:^(NSError *error){
if (nil == error) {
NSLog(@"successful");
}
else
{
UIAlertView* alert = [[UIAlertView alloc]initWithTitle:@"Error retriving content" message:[NSString stringWithFormat:@"Error code: %d",error.code] delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil];
[alert show];
}
}progressBlock:^(unsigned long long bytesDownloaded, unsigned long long bytesTotal){
if (bytesTotal == bytesDownloaded) {
CMISExtensionElement *elem = [doc.properties.extensions objectAtIndex:0];
NSString *description = [self crop:elem.description];
[self loadImage:doc.contentStreamFileName desc:description];
}
}];
}