Create a folder inside documents folder in iOS apps

I do that the following way: NSError *error; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; // Get documents folder NSString *dataPath = [documentsDirectory stringByAppendingPathComponent:@”/MyFolder”]; if (![[NSFileManager defaultManager] fileExistsAtPath:dataPath]) [[NSFileManager defaultManager] createDirectoryAtPath:dataPath withIntermediateDirectories:NO attributes:nil error:&error]; //Create folder

How to detect total available/free disk space on the iPhone/iPad device?

UPDATE: Since a lot of time has passed after this answer and new methods/APIs have been added, please check the updated answers below for Swift etc; Since I’ve not used them myself, I can’t vouch for them. Original answer: I found the following solution working for me: -(uint64_t)getFreeDiskspace { uint64_t totalSpace = 0; uint64_t totalFreeSpace … Read more

Is there any way to see the file system on the iOS simulator?

UPDATE: Since iOS 8: ~/Library/Developer/CoreSimulator/Devices The location used to be: ~/Library/Application Support/iPhone Simulator It had directories for all models of simulators (4.0, 4.1, 5.0, etc) you have ever run, go to the one you are running from in Xcode. Once in a folder, go to Applications, choose the Finder option that shows date for files, … Read more

How to check if a file exists in Documents folder?

Swift 3: let documentsURL = try! FileManager().url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: true) … gives you a file URL of the documents directory. The following checks if there’s a file named foo.html: let fooURL = documentsURL.appendingPathComponent(“foo.html”) let fileExists = FileManager().fileExists(atPath: fooURL.path) Objective-C: NSString* documentsPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0]; NSString* foofile = [documentsPath stringByAppendingPathComponent:@”foo.html”]; BOOL … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)