Tag: nsfilemanager

createFileAtPath & OCUnit & errno blues

I looked here and there but to no avail. Consider: – (void) write: (NSString *) xId data:(NSData *) data forClass: (Class) c { NSFileManager * fm = [NSFileManager defaultManager] ; NSString * instancePath = [self instancePath:xId forClass: c] ; errno = 0 ; BOOL success = [fm createFileAtPath: instancePath contents: data attributes: nil] ; if […]

NSFileManager creating directory error 518 NSFileWriteUnsupportedSchemeError

I was trying to create a directory NSError*error=nil; NSString* BIDirectory=[[NSSearchPathForDirectoriesInDomains(NSCachesDirectory,NSUserDomainMask,YES) objectAtIndex:0] stringByAppendingPathComponent:@”BI”]; BOOL isDir,flag=YES; //if the directory doesn’t exist create it. if(!([[NSFileManager defaultManager] fileExistsAtPath:BIDirectory isDirectory:&isDir]&& isDir)) flag=[[NSFileManager defaultManager] createDirectoryAtURL:[NSURL URLWithString:BIDirectory] withIntermediateDirectories:YES attributes:nil error:&error]; i got the following error enter code hereError Domain=NSCocoaErrorDomain Code=518 “The operation couldn’t be completed. (Cocoa error 518.)” UserInfo=0x197190 {NSURL=/var/mobile/Applications/55793654-6CDB-4B07-8FBF-553DC37D583D/Library/Caches/BI} maybe the […]

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

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)objectAtIndex:0]stringByAppendingPathComponent:@”/ZipFolder”]; //SourceFolder Creation […]

update progress bar during copy file with NSFileManager

I copy files then my application is finish launching from resource to caches directory. but I want to update my progress bar during copying the files. I copy the file with the code below: -(BOOL)copyDirectory:(NSString*)source toDirectory:(NSString*)targat { BOOL retVal = YES; NSFileManager *fileManager = [[NSFileManager alloc] init]; NSError *error; if ([fileManager fileExistsAtPath:targat] == YES) { […]

How to get all the names of photos only which are saved in documents folder of iphone application

i want to get all the photos names saved in my documents folder .as it contains some resources other than images,i need to select the images itelf from the documents folder and populate the names of images in an array.

Using NSOutlineView as a file browser, starting from a given directory

I’ve been following this tutorial for using NSOutlineView as a hierarchical file browser: https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/OutlineView/Articles/UsingOutlineDataSource.html I used all the code in the tutorial and it worked. However, I then tried to call initWithPath: with a path other than / and it doesn’t work: the fullPath of the top item (i.e. the folder specified in initWithPath) is […]

iOS Application Library directory <uid> always gets changed

After reading Apple documentation, I used URLsForDirectory to obtain the Library destination within my app, and my objective is to download content from a hosted service & cache it in the Library folder, so that User cannot interact with the contents through iTunes. NSArray *docPaths= [[NSFileManager defaultManager] URLsForDirectory:NSLibraryDirectory inDomains:NSUserDomainMask]; NSLog(@”%@”,[docPaths description]); NSString *docPath=[(NSURL *)[docPaths objectAtIndex:0] […]

How to save images and recorded files in temp directory?

I want to store pictures taken from camera and video recordings from my application in a separate folder in temporary directories for a while. And as the task is being completed, they shall be going to save into the database. How do I save pictures taken from camera & video recording files in a separate […]

Array of NSStrings from filenames within a folder?

I’m trying to create an array of NSStrings of the contents of a folder that I’ve dragged into my project… but when I count the items in the array afterwards, it’s always comes back with 0; So, my folder in my project looks like this -Cards -Colors Blue.png Green.png Orange.png Yellow.png Purple.png Black.png And my […]

How to find file types in objective c

I have done a lot of research on this and haven’t found anything useful. I want am making a simple program in objective c for personal use that opens files and gives information about them. The only problem i have encountered is that i cannot find the file of a file i am opening. Without […]