未找到Xcode 8符号链接sqlite3
我有一个女巫项目,我使用2个豆荚,一个使用SQLCipher的私有分支,以及使用系统sqlite3(-l“sqlite3”)的Google/Analytics。未找到Xcode 8符号链接sqlite3
当我建我的项目在Xcode 7,一切正常,但是当我建立和Xcode 8应用程序崩溃试图打开与以下原因sqlite的分贝时:
dlopen(/usr/lib/libsqlite3.dylib, 0x00000001)
dlopen(/usr/lib/libsqlite3.dylib) ==> 0x1feec4f0
dyld: lazy symbol binding failed: Symbol not found: _sqlite3_key
Referenced from: /var/containers/Bundle/Application/524A1D1F-CC6A-4F7C-B86F-CC65EAF17BD5/MyApp.app/MyApp
Expected in: /usr/lib/libsqlite3.dylib
测试:
| | iOS 8 | iOS 9 | iOS 10 |
| Xcode 7 | OK | OK | OK |
| Xcode 8 | CRASH | CRASH | * |
* app didn't crash but could not open db
Xcode 8发生了什么变化? (https://developer.apple.com/library/content/releasenotes/DeveloperTools/RN-Xcode/Introduction.html)
关于如何解决这个问题的任何建议?
不幸的是,同时使用依赖于sqlite3和SQLCipher的pod实际上并不是SQLCipher支持的方案。你可以看看这篇文章,其中包含使用SQLCipher with XCode 8作为参考的指导,但你试图做的是高风险。
斯蒂芬,我面临类似的问题提到[这里](http://*.com/q/40263384/2624806),任何建议我做错了什么。 – CoDe
链接到的帖子中的问题是每次打开数据库时必须调用PRAGMA key =或sqlite3_key。 –
如果使用pod导入,则可以添加post_install来修改OTHER_LDFLAGS,删除iOS系统sqlite3链接标志l“sqlite3”。
post_install do | installer |
installer.pods_project.targets.each do |target|
puts "#{target.name}"
target.build_configurations.each do |config|
xcconfig_path = config.base_configuration_reference.real_path
puts xcconfig_path
build_settings = Hash[*File.read(xcconfig_path).lines.map{|x| x.split(/\s*=\s*/, 2)}.flatten]
if build_settings['OTHER_LDFLAGS']
other_ldflags = build_settings['OTHER_LDFLAGS']
puts other_ldflags
if other_ldflags.include? '-l"sqlite3"'
puts "find -l sqlite3"
index = other_ldflags.index('-l"sqlite3"')
length = '-l"sqlite3"'.length
first_path = other_ldflags[0,index]
last_path = other_ldflags[index+length..-1]
exclude_ldflags = first_path + last_path
puts exclude_ldflags
build_settings['OTHER_LDFLAGS'] = exclude_ldflags
end
# write build_settings dictionary to xcconfig
File.open(xcconfig_path, "w")
build_settings.each do |key,value|
File.open(xcconfig_path, "a") {|file| file.puts "#{key} = #{value}"}
end
end
end
end
末
块引用
我使用sqlCipher,我得到了这个问题dyld: lazy symbol binding failed: Symbol not found: _sqlite3_key
了。我所做的是将-all_load
标志添加到项目Build Settings
- >Other Linker Flags
,然后一切正常。希望这可能有助于某人。 :)
[此问题](http://*.com/questions/6355893/implicit-declaration-of-function-sqlite3-key)似乎表明'sqlite3_key()'不包括在iOS中版本的sqlite3。你也可以关闭这个库的延迟加载? – Droppy
@Droppy你会如何建议我关闭延迟加载? – Daniel
@丹尼尔我正面临着类似的问题,你能否建议你的解决方案! – CoDe