I have an project in witch I use 2 pods, a private one that uses SQLCipher, and Google/Analytics that uses the systems sqlite3 (-l"sqlite3").
我在witch中有一个项目,我使用2个豆荚,一个私有的豆荚使用SQLCipher,谷歌/Analytics使用system sqlite3 (-l“sqlite3”)。
When I build my project with Xcode 7, everything works correctly, but when I build with Xcode 8 app crashes when trying to open the sqlite db with the following reason:
当我用Xcode 7构建我的项目时,一切都正常,但是当我用Xcode 8构建时,当我试图打开sqlite db时,由于以下原因:
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
Tested:
测试:
| | iOS 8 | iOS 9 | iOS 10 |
| Xcode 7 | OK | OK | OK |
| Xcode 8 | CRASH | CRASH | * |
* app didn't crash but could not open db
What did Xcode 8 change? (https://developer.apple.com/library/content/releasenotes/DeveloperTools/RN-Xcode/Introduction.html)
Any suggestions on how to fix this?
Xcode 8改变了什么?(https://developer.apple.com/library/content/releasenotes/developertools/rn - xcode/tion.html)对此有什么建议吗?
3 个解决方案
#1
1
Unfortunately, simultaneously using pods dependent on sqlite3 and SQLCipher isn't really a supported scenario with SQLCipher. You might check out this article containing guidance for using SQLCipher with XCode 8 for reference, but what you are trying to do is high risk.
不幸的是,同时使用依赖于sqlite3和SQLCipher的pods不是SQLCipher支持的场景。您可能会查看这篇文章,其中包含了使用SQLCipher使用XCode 8作为参考的指导,但是您想要做的是高风险。
#2
0
If use pod import, you can add post_install to modify OTHER_LDFLAGS, remove iOS system sqlite3 link flag l"sqlite3".
如果使用pod导入,可以添加post_install来修改OTHER_LDFLAGS,删除iOS系统sqlite3 link flag l“sqlite3”。
post_install do |installer|
| | post_install做安装程序
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
end
结束
Blockquote
引用
#3
0
I'm using sqlCipher and I got this problem dyld: lazy symbol binding failed: Symbol not found: _sqlite3_key
too. What I do is to add -all_load
flag to project Build Settings
-> Other Linker Flags
, then all works fine. Hope this maybe help to someone. :)
我正在使用sqlCipher,我得到了这个问题:dyld: lazy symbol binding failed: symbol not found: _sqlite3_key。我要做的是将-all_load标志添加到项目构建设置中——>其他链接器标志,然后所有这些都可以正常工作。希望这对某人有帮助。:)
#1
1
Unfortunately, simultaneously using pods dependent on sqlite3 and SQLCipher isn't really a supported scenario with SQLCipher. You might check out this article containing guidance for using SQLCipher with XCode 8 for reference, but what you are trying to do is high risk.
不幸的是,同时使用依赖于sqlite3和SQLCipher的pods不是SQLCipher支持的场景。您可能会查看这篇文章,其中包含了使用SQLCipher使用XCode 8作为参考的指导,但是您想要做的是高风险。
#2
0
If use pod import, you can add post_install to modify OTHER_LDFLAGS, remove iOS system sqlite3 link flag l"sqlite3".
如果使用pod导入,可以添加post_install来修改OTHER_LDFLAGS,删除iOS系统sqlite3 link flag l“sqlite3”。
post_install do |installer|
| | post_install做安装程序
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
end
结束
Blockquote
引用
#3
0
I'm using sqlCipher and I got this problem dyld: lazy symbol binding failed: Symbol not found: _sqlite3_key
too. What I do is to add -all_load
flag to project Build Settings
-> Other Linker Flags
, then all works fine. Hope this maybe help to someone. :)
我正在使用sqlCipher,我得到了这个问题:dyld: lazy symbol binding failed: symbol not found: _sqlite3_key。我要做的是将-all_load标志添加到项目构建设置中——>其他链接器标志,然后所有这些都可以正常工作。希望这对某人有帮助。:)