gpt4 book ai didi

ios - 他们是将 sqlite 数据库文件与 os x 应用程序捆绑在一起的方法吗?两者成为一个文件

转载 作者:行者123 更新时间:2023-11-29 02:28:08 26 4
gpt4 key购买 nike

我试过 sqlite FMDB,但它必须将数据库存储到单独的文件中

最佳答案

方法如下:使用传统方式生成的文件系统的文件句柄创建数据库(NSSearchPathForDirectoriesInDomainsstringByAppendingPathComponent: @"mydb.sql") .

听起来你已经完成了。将生成的文件拖到您的应用程序中。进入您的应用程序包后,获取文件的方式如下(使用我在上面编写的文件名):

NSString *fileName = [[NSBundle mainBundle] pathForResource:@"mydb" ofType:@"sql"];
// or whatever you called the file in your bundle, use ofType: as the filename's extension

这应该足以作为 FMDB 包的输入。

关于ios - 他们是将 sqlite 数据库文件与 os x 应用程序捆绑在一起的方法吗?两者成为一个文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27234456/

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