开发者

Create a Blank File If Not Already Exist?

开发者 https://www.devze.com 2023-02-03 15:19 出处:网络
I added a blank file to the application resources but it is not found in the build, how would i programmatically check and create a file if it d开发者_高级运维oesn\'t already exist?First of all you ca

I added a blank file to the application resources but it is not found in the build, how would i programmatically check and create a file if it d开发者_高级运维oesn't already exist?


First of all you can write only to application Documents directory.

- (BOOL)createFileAtPath:(NSString *)path contents:(NSData *)contents attributes:(NSDictionary *)attributes

NSFileManager doc here


You can do this as a custom build step (which is in fact a simple shell script). For example, just add touch yourfilename

0

精彩评论

暂无评论...
验证码 换一张
取 消