SQLCipher 在 Cocoapods 1.5+ 引入的报错问题

在升级了Cocoapods 到 1.5 以后, pod install 后, 编译报错:

Implicit declaration of function ‘sqlite3_key’ is invalid in C99
Implicit declaration of function ‘sqlite3_rekey’ is invalid in C99

但 Other Link Flag 之类的都已经设置好了, 仍然报错, 最终找到解决方案如下:

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'testPodFMDB' do
    # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
    use_frameworks!
    
    # Pods for testPodFMDB
    pod 'FMDB/SQLCipher'
    
    post_install do |installer|
        installer.pods_project.targets.each do |target|
            if target.name == "FMDB"
                config_path = target.build_configurations[0].base_configuration_reference.real_path
                File.open(config_path, "a") {|file| file.write("HEADER_SEARCH_PATHS = SQLCipher")}
            end
        end
    end
    
end

具体细节请参照:
https://discuss.zetetic.net/t/ios-11-xcode-issue-implicit-declaration-of-function-sqlite3-key-is-invalid-in-c99/2198

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容