我的应用程序使用供应商 - 静态库,它不喜欢“-all_load”链接器标志。 如果我使用它会抛出重复的错误。
我现在的问题是我也需要使用新的盒子sdk。 SDK的podspec具有以下内容。
s.xcconfig = { "OTHER_LDFLAGS" => "-ObjC -all_load" }因此,构建失败,供应商lib中出现重复符号。
我在网上看到,我只能在需要-ObjC -all_load的库上使用-force_load来避免陷入这种情况。 我无法使用它作为解决方案,因为我无法控制BOX podspec
有没有办法可以在我的应用程序中覆盖任何这些; 我真的很感激任何帮助。
My app uses a vendor - static library that doesn't like the "-all_load" linker flag. It would throw duplicate errors if i used it.
The problem i have right now is i need to use the new box sdk as well. The podspec of the SDK has the below.
s.xcconfig = { "OTHER_LDFLAGS" => "-ObjC -all_load" }Therefore, the build fails with duplicate symbols in the vendor lib.
I've read online that i can avoid getting in such a situation by using -force_load only on the library that needs -ObjC -all_load. I cannot use that as a solution because i have no control over BOX podspec
Is there a way i can override any of these in my app; I'd really appreciate any help.
最满意答案
经过几个小时的斗争,我想到了如何完成这项工作。 在此发布,以便它可以帮助遇到类似问题的人。 我将下面的post_install挂钩添加到Podfile中,并且它有效!
post_install do |installer_representation| installer_representation.project.targets.each do |target| target.build_configurations.each do |config| if target.name == "Pods" xcconfig_path = config.base_configuration_reference.real_path xcconfig = File.read(xcconfig_path) new_xcconfig = xcconfig.gsub("-ObjC -all_load",'-force_load $(BUILT_PRODUCTS_DIR)/libPods-box-ios-sdk.a') File.open(xcconfig_path, "w") { |file| file << new_xcconfig } end end end endAfter battling with this for a few hours, i figured how to get this done. Posting it here so that it might help someone who get into a similar problem. I added the below post_install hook to the Podfile and voi-la it worked!!
post_install do |installer_representation| installer_representation.project.targets.each do |target| target.build_configurations.each do |config| if target.name == "Pods" xcconfig_path = config.base_configuration_reference.real_path xcconfig = File.read(xcconfig_path) new_xcconfig = xcconfig.gsub("-ObjC -all_load",'-force_load $(BUILT_PRODUCTS_DIR)/libPods-box-ios-sdk.a') File.open(xcconfig_path, "w") { |file| file << new_xcconfig } end end end end更多推荐
发布评论