I am modularising a large iOS app lets say, MyAppWithDatabase
into two modules (i.e. projects). So I will have one main project MyApp
as a host and a linked MyDataPlatform
as a framework under same workspace MyApp.xcworkspace
. When SQLCipher
pod was integrated for target MyAppWithDatabase
it worked fine, but as all of the database related codes are being moved into MyDataPlatform
framework in refactoring, I want to integrate SQLCipher
pod only for the framework to keep internal encryption mechanism abstract from host app. Now, when I have integrated for framework it started producing below build error.
Implicit declaration of function ‘sqlite3_key’ is invalid in C99
Note that this issue is being produced from one statement of MyApp
s source code as a warning but Xcode build treating it as error,
sqlite3_key(_db, [password UTF8String], (int)password.length);
I have the above line still remaining in MyApp
because it takes time to move database related codes gradually into MyDataPlatform
and I assume the SQLCipher headers are still supposed to be available in host app as the related framework in linked.
I have gone through many proposed solutions on the Internet but none of them worked for my case. I doubt most of the solutions are about integrating SQLCipher
for host app only. What should I do when I get the error for framework in my case?
Below is the structure of my pod file (after refactored),
# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
workspace 'MyApp.xcworkspace'
target 'MyApp' do
# Uncomment this line if you're using Swift or would like to use dynamic frameworks
use_frameworks!
pod 'Google/Analytics'
pod 'GoogleMaps'
# ...
target 'MyAppTests' do
inherit! :search_paths
end
end
target 'MyDataPlatform' do
project 'MyDataPlatform/MyDataPlatform.xcodeproj'
pod 'SQLCipher', '~>3.4.2'
#https://discuss.zetetic.net/t/ios-11-xcode-issue-implicit-declaration-of-function-sqlite3-key-is-invalid-in-c99/2198/53
post_install do | installer |
print "SQLCipher: link Pods/Headers/sqlite3.h"
system "mkdir -p Pods/Headers/Private && ln -s ../../SQLCipher/sqlite3.h Pods/Headers/Private"
end
end
Previously SQLCipher
was integrated under MyAppWithDatabase
i.e.
# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
target 'MyAppWithDatabase' do
# Uncomment this line if you're using Swift or would like to use dynamic frameworks
use_frameworks!
pod 'Google/Analytics'
pod 'GoogleMaps'
pod 'SQLCipher', '~>3.4.2'
# ...
target 'MyAppWithDatabaseTests' do
inherit! :search_paths
end
end