WCDB iOS/macOS常见问题
若是通过cocoapods安装的WCDB,可清理并更新缓存后重试。执行脚本:
编译错误 Since WCDB is an Objective-C++ framework, for those files in your project that includes WCDB, you should rename their extension .m to .mm.
WCDB需要使用Objective-C++进行编译。将引用WCDB的文件需要修改文件名后缀为.mm
。
在Xcode的View
->Navigators
->Show Report Navigator
的build
中,可以找到编译出错的文件。将其后缀名改为即可。
pod install、carthage update、git clone等命令卡住
Cocoapods本地缓存问题。需执行pod repo update
更新本地缓存。若仍无法解决,则清理缓存后重试,执行脚本
在offset函数报错:'Expected parameter declarator'
其他库的代码存在不规范的宏定义,将offset定义为别的字符串了。
编译错误 'type_traints' file not found
C++库使用不正确,应使用C++11。将工程的Build Settings
->Language - C++
->C++ Standard Library
改为libc++
即可。
- 将工程配置的
Build Settings
->Language - C++
->C++ Language Dialect
改为GNU++98
以上两种方法二选一即可。
Xcode不出现代码提示
修改文件名后缀为.mm
后,Xcode需要重建索引。重启Xcode或等待一段时间后可解决。
命令行无法打开WCDB创建的加密数据库
除了password,还需要设置cipher的page size,默认为4096
需在 podfile 中添加 的定义