Cocoapods“OTHER

编程入门 行业动态 更新时间:2024-10-26 20:22:15
Cocoapods“OTHER_LDFLAGS”由于-all_load而重复符号(Cocoapods “OTHER_LDFLAGS ” Duplicate symbols because of -all_load)

我的应用程序使用供应商 - 静态库,它不喜欢“-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 end

After 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

更多推荐

本文发布于:2023-08-01 18:24:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1362827.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Cocoapods

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!