spoonconsulting / cordova-plugin-background-upload

Cordova plugin for background upload
Apache License 2.0
51 stars 54 forks source link

"duplicate symbols" related to AFNetworking #190

Open hughknaus opened 2 years ago

hughknaus commented 2 years ago

I upgraded from 1.1.0 to 2.0.7 for Android. I'm now working on upgrading the iOS side from cordova-ios@5.1.1 to cordova-ios@6.2.0. cordova-plugin-background-upload@2.0.7 has a requirement to install cocoapods, which required an upgrade in ruby for us. I also installed rubygems for bundler and fastlane. The iOS build results in "duplicate symbols" errors:

...
[16:32:59]  duplicate symbol '_OBJC_IVAR_$_AFImageResponseSerializer._automaticallyInflatesResponseImage' in:
[16:32:59]      /Users/buildagent/Library/Developer/Xcode/DerivedData/Assist-fjvetwvbnjusdnghjhrzeyodghkr/Build/Intermediates.noindex/ArchiveIntermediates/Assist/IntermediateBuildFilesPath/Assist.build/Release-iphoneos/Assist.build/Objects-normal/arm64/SM_AFURLResponseSerialization.o
[16:32:59]      /Users/buildagent/TCBuildAgent/work/61a78f4c40187309/platforms/ios/build/device/libAFNetworking.a(AFURLResponseSerialization.o)
[16:32:59]  duplicate symbol '_OBJC_CLASS_$__AFURLSessionTaskSwizzling' in:
[16:32:59]      /Users/buildagent/Library/Developer/Xcode/DerivedData/Assist-fjvetwvbnjusdnghjhrzeyodghkr/Build/Intermediates.noindex/ArchiveIntermediates/Assist/IntermediateBuildFilesPath/Assist.build/Release-iphoneos/Assist.build/Objects-normal/arm64/SM_AFURLSessionManager.o
[16:32:59]      /Users/buildagent/TCBuildAgent/work/61a78f4c40187309/platforms/ios/build/device/libAFNetworking.a(AFURLSessionManager.o)
[16:32:59]  duplicate symbol '_OBJC_METACLASS_$__AFURLSessionTaskSwizzling' in:
[16:32:59]      /Users/buildagent/Library/Developer/Xcode/DerivedData/Assist-fjvetwvbnjusdnghjhrzeyodghkr/Build/Intermediates.noindex/ArchiveIntermediates/Assist/IntermediateBuildFilesPath/Assist.build/Release-iphoneos/Assist.build/Objects-normal/arm64/SM_AFURLS/Users/buildagent/TCBuildAgent/work/61a78f4c40187309/platforessionManager.o
[16:32:59]      /Users/buildagent/TCBuildAgent/work/61a78f4c40187309/platforms/ios/build/device/libAFNetworking.a(AFURLSessionManager.o)
[16:32:59]  ld: 89 duplicate symbols for architecture arm64
[16:32:59]  clang: error: linker command failed with exit code 1 (use -v to see invocation)
...

I found that cordova-plugin-advanced-http is currently referencing the AFNetworking (albeit renamed to SM_AFNetworking) and the imports in this plugin might be causing the "duplicate symbols", has anyone else ran into this and found a resolution? Cross reference issue on cordova-plugin-advanced-http: https://github.com/silkimen/cordova-plugin-advanced-http/issues/435

hughknaus commented 2 years ago

Additionally, when I remove cordova-plugin-background-upload from my app I can build without getting the "duplicate symbols" errors (of course that is undesirable as we do need the functionality for background uploading).

zfir commented 2 years ago

Hello @hughknaus,

We have a forked version of cordova-plugin-advanced-http. We also got some problems regarding AFNetworking. You can try to use this PR in your build: https://github.com/spoonconsulting/cordova-plugin-advanced-http/pull/3

Regards, Zafir

hughknaus commented 2 years ago

@zafirskthelifehacker Thank you, I'll give it a try today.

hughknaus commented 2 years ago

@zafirskthelifehacker with https://github.com/spoonconsulting/cordova-plugin-advanced-http/pull/3 we were able to get a build and the app runs! A step in the right direction. We have to do some additional testing to do on our side but it definitely looks promising! Thanks again.

zfir commented 2 years ago

Hello @hughknaus,

Great to hear that. After you complete the tests, can you try to merge this PR(https://github.com/spoonconsulting/cordova-plugin-advanced-http/pull/3) on the base repository(https://github.com/silkimen/cordova-plugin-advanced-http)?

Thanks.

Regards, Zafir.

zfir commented 2 years ago

We have already created a PR there: https://github.com/silkimen/cordova-plugin-advanced-http/pull/459. Try to see if it can be merged.

Regards, Zafir.

silkimen commented 2 years ago

Just merged your PR. It's fixed in cordova-plugin-advanced-http v3.3.1 👍