nsdocumentdirectory

Retrieve multiple images from document directory

喜你入骨 提交于 2019-12-10 12:19:30
问题 I have folder named "2" in document directory. Now in folder "2", I have five images named 0.png, 1.png, 2.png, 3.png and 4.png. I want to retrieve these images and save into an array. I have code but it returns only one image. int b=2; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSLog(@"%@",paths); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *getImagePath = [documentsDirectory stringByAppendingPathComponent:[NSString

Download file to Folder in iPhone

为君一笑 提交于 2019-12-10 12:02:31
问题 I am new to iPhone, I made app in which, when user downloads anything it gets downloaded into DocumentDirectory I wants downloading inside my folder which i have created in DocumentDirectory How to achieve this ? I thought I will download file to my DocumentDirectory and i will move that file to my folder inside DocumentDirectory . Is it good practice ? Here is my code snippet, But still i am unable to move my file. - (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*

I want to crete a zip file with multiple images in it and get the entire zip file and send to sftp server

让人想犯罪 __ 提交于 2019-12-08 14:25:59
问题 I am trying create a zip file from the contents of another directory in NSdcomentDirectory. I am using "SSZipArchive" for this. But When I try to get the zip file its not available.Here is my code which I am trying. ` NSString *stringPath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)objectAtIndex:0]stringByAppendingPathComponent:@"/SourceFolder"]; NSString *stringPath2 = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES

iOS8 Document directory path

最后都变了- 提交于 2019-12-08 09:29:07
问题 Issue in iOS8 document directory path detection: Am using following code to store downloaded attachments from my app into documents directory path. //-- Store data to documents folder NSString *resourceDocPath = [[NSString alloc] initWithString:[ [[[NSBundle mainBundle] resourcePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"Documents"]]; NSString *filePath = [resourceDocPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@",fileName]]; [self

How to hide folder in NSDocumentsDirectory and disallow backup via iTunes & iCloud

狂风中的少年 提交于 2019-12-07 13:27:17
问题 I create private folder in NSDocumentDirectory and i want to hide it in iTunes and disallow to backup. In this question How to hide folders created in Document Directory in ios? people suggest to save in private directory. But it's not ok according apple documentation https://developer.apple.com/library/mac/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html Application_Home/Library/ You should not use this directory for user data

max length of file name

心已入冬 提交于 2019-12-06 18:06:41
问题 i am using the code below to save an image in the NSDocumentDirectory -(BOOL)saveImage:(UIImage *)image name:(NSString *)name{ NSString *dir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; NSString *path = [NSString pathWithComponents:[NSArray arrayWithObjects:dir, name, nil]]; BOOL ok = [[NSFileManager defaultManager] createFileAtPath:path contents:nil attributes:nil]; if (!ok) { NSLog(@"Error creating file %@", path); } else {

saving image to documents directory no longer works iOS8

。_饼干妹妹 提交于 2019-12-06 14:26:45
Saving images to the documents directory does not seem to working anymore in iOS8. I had hear that there was Changes To App Containers In iOS 8 . But I still cant seem to get my code to work. I save an image to the documents directory, and retrieve it later to use. Here is my code for saving the image in the documents directory; -(void) simpleCam:(SimpleCam *)simpleCam didFinishWithImage:(UIImage *)image { if (![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) { //choose Photo }else{ if (image) { //save the image to photos library

iPhone: move resources to Application bundle

人走茶凉 提交于 2019-12-06 12:48:14
问题 My application just got rejected from Apple because I store my resources under Documents folder! The Documents folder gets synched to iCloude automatically so only user generated data should be stored under Documents. All application data should go under Application bundle. I use following method through out my project - (NSString *)filePath:(NSString *)fileName { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory =

How to delete all the files under my app's NSDocumentsDirectory?

时光毁灭记忆、已成空白 提交于 2019-12-06 09:46:42
问题 I tried using NSString *DocumentsDirectoryPath = //Code to fetch the Documents Directory Path; NSError *error; NSFileManager *manager = [NSFileManager defaultManager]; [manager removeItemAtPath:DocumentsDirectoryPath error:&error]; The above code deletes the whole Documents directory of my app, but I just want to delete contents of the Documents directory not the Documents directory itself. What should I do? 回答1: NSString *docsDir = [NSHomeDirectory() stringByAppendingPathComponent:@

iOS - Saving multiple images to Documents folder

不羁的心 提交于 2019-12-06 06:37:01
问题 I have this code this code to save an image to the Documents folder. NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *savedImagePath = [documentsDirectory stringByAppendingPathComponent:@"savedImage.png"]; UIImage *image = imageView.image; // imageView is my image from camera NSData *imageData = UIImagePNGRepresentation(image); [imageData writeToFile:savedImagePath atomically:NO]