gpt4 book ai didi

cocoa-touch - objective-c :以编程方式将文件写入Main Bundle

转载 作者:行者123 更新时间:2023-12-01 18:03:11 25 4
gpt4 key购买 nike

Possible Duplicate:
Writing into a file objective c


如何创建文件并将文件写入捆绑包?我有这个:

//make path to file
NSString* documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *filePath = [documentsPath stringByAppendingPathComponent:[NSString stringWithFormat:@"usnews.txt", [sharedManager.articleNumber intValue] + 1]];
//write file
[textContent writeToFile:filePath atomically:YES encoding:NSUTF8StringEncoding error:nil];

但会将其写入documents文件夹,并在应用程序关闭时被删除。

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com