Which one of these 2 cases is faster in creating files?
Case 1:
======
NSData *data = [Some data];
[data writeToFile:filePath atomically:YES];
Case 2:
=======
NSFileManager *fileManager = [NSFileManager defaultManager];
[fileManager createFileAtPath:filePath contents:data attributes:nil];
Thanks Biranchi.
Having stored the contents of a file in an NSData object, that data may subsequently be written out to a new file using the createFileAtPath method: databuffer = [filemgr contentsAtPath: @"/tmp/myfile. txt" ]; [filemgr createFileAtPath: @"/tmp/newfile. txt" contents: databuffer attributes: nil];
To request creation of a new fileRight click the parent folder that will contain the new file. 2. Select New > Add File to open the Add File to Objective window.
A . a file is a compiled static library file (aka archive). It does not contain any source code, only object code for one or more architectures.
Creating a Custom ClassGo ahead an choose “Objective-C class” and hit Next. For the class name, enter “Person.” Make it a subclass of NSObject. NSObject is the base class for all objects in Apple's developer environment. It provides basic properties and functions for memory management and allocation.
Why are you worrying about this... Are you going to be writing data frequently.. at like 60 FPS ?.. or 60 SPS (Saves per second) :D
Use any of the above
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With