Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] [iOS]Xcode13 duplicate symbol error #435

Closed
haofanning opened this issue Oct 12, 2021 · 22 comments
Closed

[Bug] [iOS]Xcode13 duplicate symbol error #435

haofanning opened this issue Oct 12, 2021 · 22 comments

Comments

@haofanning
Copy link

The new iOS version plugin conflicts with AFNetworking. The error message is:

duplicate symbol 'OBJC_CLASS$_AFCompoundResponseSerializer' in:
/Users/macmini_3/Library/Developer/Xcode/DerivedData/mp_ios_eim-aeasddxpzolijrfjwreqmesibntn/Build/Products/Debug-iphoneos/AFNetworking/AFNetworking.framework/AFNetworking(AFURLResponseSerialization.o)
/Users/macmini_3/Desktop/金企信/金企信v2/引用库/PluginLib/PluginLib/Plugin_Http.framework/Plugin_Http(SM_AFURLResponseSerialization.o)
duplicate symbol 'OBJC_CLASS$_AFHTTPResponseSerializer' in:
/Users/macmini_3/Library/Developer/Xcode/DerivedData/mp_ios_eim-aeasddxpzolijrfjwreqmesibntn/Build/Products/Debug-iphoneos/AFNetworking/AFNetworking.framework/AFNetworking(AFURLResponseSerialization.o)
/Users/macmini_3/Desktop/金企信/金企信v2/引用库/PluginLib/PluginLib/Plugin_Http.framework/Plugin_Http(SM_AFURLResponseSerialization.o)
duplicate symbol 'OBJC_CLASS$_AFImageResponseSerializer' in:
/Users/macmini_3/Library/Developer/Xcode/DerivedData/mp_ios_eim-aeasddxpzolijrfjwreqmesibntn/Build/Products/Debug-iphoneos/AFNetworking/AFNetworking.framework/AFNetworking(AFURLResponseSerialization.o)
/Users/macmini_3/Desktop/金企信/金企信v2/引用库/PluginLib/PluginLib/Plugin_Http.framework/Plugin_Http(SM_AFURLResponseSerialization.o)
duplicate symbol 'OBJC_CLASS$_AFJSONResponseSerializer' in:
/Users/macmini_3/Library/Developer/Xcode/DerivedData/mp_ios_eim-aeasddxpzolijrfjwreqmesibntn/Build/Products/Debug-iphoneos/AFNetworking/AFNetworking.framework/AFNetworking(AFURLResponseSerialization.o)
/Users/macmini_3/Desktop/金企信/金企信v2/引用库/PluginLib/PluginLib/Plugin_Http.framework/Plugin_Http(SM_AFURLResponseSerialization.o)
duplicate symbol 'OBJC_CLASS$_AFPropertyListResponseSerializer' in:
/Users/macmini_3/Library/Developer/Xcode/DerivedData/mp_ios_eim-aeasddxpzolijrfjwreqmesibntn/Build/Products/Debug-iphoneos/AFNetworking/AFNetworking.framework/AFNetworking(AFURLResponseSerialization.o)
/Users/macmini_3/Desktop/金企信/金企信v2/引用库/PluginLib/PluginLib/Plugin_Http.framework/Plugin_Http(SM_AFURLResponseSerialization.o)
duplicate symbol 'OBJC_CLASS$_AFXMLParserResponseSerializer' in:
/Users/macmini_3/Library/Developer/Xcode/DerivedData/mp_ios_eim-aeasddxpzolijrfjwreqmesibntn/Build/Products/Debug-iphoneos/AFNetworking/AFNetworking.framework/AFNetworking(AFURLResponseSerialization.o)
/Users/macmini_3/Desktop/金企信/金企信v2/引用库/PluginLib/PluginLib/Plugin_Http.framework/Plugin_Http(SM_AFURLResponseSerialization.o)
duplicate symbol 'OBJC_IVAR$_AFCompoundResponseSerializer._responseSerializers' in:
/Users/macmini_3/Library/Developer/Xcode/DerivedData/mp_ios_eim-aeasddxpzolijrfjwreqmesibntn/Build/Products/Debug-iphoneos/AFNetworking/AFNetworking.framework/AFNetworking(AFURLResponseSerialization.o)
/Users/macmini_3/Desktop/金企信/金企信v2/引用库/PluginLib/PluginLib/Plugin_Http.framework/Plugin_Http(SM_AFURLResponseSerialization.o)
duplicate symbol 'OBJC_IVAR$_AFHTTPResponseSerializer._acceptableContentTypes' in:
/Users/macmini_3/Library/Developer/Xcode/DerivedData/mp_ios_eim-aeasddxpzolijrfjwreqmesibntn/Build/Products/Debug-iphoneos/AFNetworking/AFNetworking.framework/AFNetworking(AFURLResponseSerialization.o)
/Users/macmini_3/Desktop/金企信/金企信v2/引用库/PluginLib/PluginLib/Plugin_Http.framework/Plugin_Http(SM_AFURLResponseSerialization.o)
duplicate symbol 'OBJC_IVAR$_AFHTTPResponseSerializer._acceptableStatusCodes' in:
/Users/macmini_3/Library/Developer/Xcode/DerivedData/mp_ios_eim-aeasddxpzolijrfjwreqmesibntn/Build/Products/Debug-iphoneos/AFNetworking/AFNetworking.framework/AFNetworking(AFURLResponseSerialization.o)
/Users/macmini_3/Desktop/金企信/金企信v2/引用库/PluginLib/PluginLib/Plugin_Http.framework/Plugin_Http(SM_AFURLResponseSerialization.o)

@azharbeebeejaun
Copy link

Hi @haofanning, could you get it to work? We also have AFNetworking being installed by another plugin and the build fails because of duplicate symbols.

@haofanning
Copy link
Author

haofanning commented Jan 4, 2022

@azharbeebeejaun No,I cant make it work, so I have to use the old version of cordova-plugin-advanced-http.

@hughknaus
Copy link

hughknaus commented Feb 23, 2022

I too am receiving 89 duplicate symbols for architecture arm64 errors and they do all appear related to AFNetworking when upgrading to cordova-ios 6.2.0 and cordova-plugin-advanced-http 3.2.2 (also tried downgrading to 3.0.0 but ended up with 157 duplicate symbols), however, I'm using Xcode 12.5:

First few lines of duplicates:

[09:01:32]	duplicate symbol '_AFStringFromNetworkReachabilityStatus' in:
[09:01:32]	    /Users/buildagent/Library/Developer/Xcode/DerivedData/Assist-fjvetwvbnjusdnghjhrzeyodghkr/Build/Intermediates.noindex/ArchiveIntermediates/Assist/IntermediateBuildFilesPath/Assist.build/Release-iphoneos/Assist.build/Objects-normal/arm64/SM_AFNetworkReachabilityManager.o
[09:01:32]	    /Users/buildagent/TCBuildAgent/work/61a78f4c40187309/platforms/ios/build/device/libAFNetworking.a(AFNetworkReachabilityManager.o)
[09:01:32]	duplicate symbol '_OBJC_IVAR_$_AFHTTPBodyPart._boundary' in:
[09:01:32]	    /Users/buildagent/Library/Developer/Xcode/DerivedData/Assist-fjvetwvbnjusdnghjhrzeyodghkr/Build/Intermediates.noindex/ArchiveIntermediates/Assist/IntermediateBuildFilesPath/Assist.build/Release-iphoneos/Assist.build/Objects-normal/arm64/SM_AFURLRequestSerialization.o
[09:01:32]	    /Users/buildagent/TCBuildAgent/work/61a78f4c40187309/platforms/ios/build/device/libAFNetworking.a(AFURLRequestSerialization.o)
[09:01:32]	duplicate symbol '_OBJC_IVAR_$_AFStreamingMultipartFormData._boundary' in:
[09:01:32]	    /Users/buildagent/Library/Developer/Xcode/DerivedData/Assist-fjvetwvbnjusdnghjhrzeyodghkr/Build/Intermediates.noindex/ArchiveIntermediates/Assist/IntermediateBuildFilesPath/Assist.build/Release-iphoneos/Assist.build/Objects-normal/arm64/SM_AFURLRequestSerialization.o
[09:01:32]	    /Users/buildagent/TCBuildAgent/work/61a78f4c40187309/platforms/ios/build/device/libAFNetworking.a(AFURLRequestSerialization.o)
[09:01:32]	duplicate symbol '_OBJC_IVAR_$_AFHTTPBodyPart._hasFinalBoundary' in:
[09:01:32]	    /Users/buildagent/Library/Developer/Xcode/DerivedData/Assist-fjvetwvbnjusdnghjhrzeyodghkr/Build/Intermediates.noindex/ArchiveIntermediates/Assist/IntermediateBuildFilesPath/Assist.build/Release-iphoneos/Assist.build/Objects-normal/arm64/SM_AFURLRequestSerialization.o
[09:01:32]	    /Users/buildagent/TCBuildAgent/work/61a78f4c40187309/platforms/ios/build/device/libAFNetworking.a(AFURLRequestSerialization.o)
...

@haofanning did you find a version of the plugin that worked?

@haofanning
Copy link
Author

haofanning commented Feb 25, 2022

@hughknaus I have an old version locally that I downloaded earlier,It depend on AFNetworking.If you want this version,give me your email address,I can send it to you.

@hughknaus
Copy link

@haofanning what version of cordova-ios and cordova-android are you using with your old version of cordova-plugin-advanced-http?

@haofanning
Copy link
Author

@hughknaus cordova-ios is newest version 6.2.0 , and I am not sure the version of cordova-plugin-advanced-http, sorry for that , maybe it's 3.0.0

@hughknaus
Copy link

@haofanning I was actually moving from 3.0.0 to 3.2.2 because I was getting the same "duplicate symbols" error (only more of them) and I was hoping 3.2.2 would help. I think this started because we had another cordova plugin that required build dependency changes, cordova-plugin-background-upload upgrade from 1.1.0 to 2.0.7 requires cocoapods, which caused us to have to install a newer version of ruby, followed that up with gem installs of bundle and fastlane . I was also trying to upgrade cordova-ios from 5.1.1 to 6.2.0, but I'm wondering if it has something to do with the build system...

@haofanning
Copy link
Author

haofanning commented Mar 2, 2022

@hughknaus I think you are going in the wrong direction. I think this error is caused by a conflict between the AFNetworking library and newest version cordova-plugin-advanced-http, because the code of the AFNetworking library is used by the latest version of cordova-plugin-advanced-http, resulting in variable redefinition. So the solution is to roll back cordova-plugin-advanced-http to a historical version that does not use SM_AFNetworking or do not refer to AFNetworking when using cordova-plugin-advanced-http.

@haofanning
Copy link
Author

haofanning commented Mar 2, 2022

@hughknaus Maybe AFNetworking's code is also used in cordova-plugin-background-upload, causing cordova-plugin-background-upload to conflict with cordova-plugin-advanced-http.

@hughknaus
Copy link

hughknaus commented Mar 2, 2022

@haofanning Thank you for mentioning that... it's the one thing I didn't check! And it IS using AFNetworking!

image

@haofanning
Copy link
Author

@hughknaus You are welcome

@hughknaus
Copy link

hughknaus commented Mar 2, 2022

I noticed that this commit (c2a0317), with message of

replacing AFNewtworking file and classes names to prevent conflicts with the real AFNetworking pod

renames all the AFNetworking to SM_AFNetworking and the "duplicate symbols" errors that I get relate to SM_AFNetworking, and cordova-plugin-background-upload doesn't have references to SM_AFNetworking (but they import AFNetworking).

@haofanning
Copy link
Author

haofanning commented Mar 3, 2022

@hughknaus That's why i say you can give me your email address, I have the iOS old version of cordova-plugin-advanced-http and it import AFNetworking too(not include SM_AFNetworking inside). I think it can solve your problem.

@hughknaus
Copy link

@haofanning I was using 3.0.0, it uses AFNetworking and I get even more "duplicate symbols" with it. From the commit (c2a0317) I imagine that's why they renamed it to SM_AFNetworking, but something else is causing the duplicates with it. I have found no good solution.

@haofanning
Copy link
Author

@hughknaus OK then, that seems to work for me so far. Maybe you can find all SM_AFNetworking,make sure it doesn't exist in your project.

@hughknaus
Copy link

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

@hughknaus
Copy link

hughknaus commented Mar 7, 2022

In https://github.com/silkimen/cordova-plugin-advanced-http/blob/9ff32f1892c46f6eeadb287bf73cdbd6ed7b4769/src/ios/SM_AFNetworking/SM_AFURLSessionManager.m

Does this interface

@interface _AFURLSessionTaskSwizzling : NSObject

and this implementation
@implementation _AFURLSessionTaskSwizzling

not conflict with AFNetworking interface https://github.com/AFNetworking/AFNetworking/blob/77ef5fed64d98107acd177a90182163a20ba4567/AFNetworking/AFURLSessionManager.m#L343
and AFNetworking implementation https://github.com/AFNetworking/AFNetworking/blob/77ef5fed64d98107acd177a90182163a20ba4567/AFNetworking/AFURLSessionManager.m#L347

[11:13:48]	duplicate symbol '_OBJC_METACLASS_$__AFURLSessionTaskSwizzling' in:
[11:13:48]	    /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
[11:13:48]	    /Users/buildagent/TCBuildAgent/work/61a78f4c40187309/platforms/ios/build/device/libAFNetworking.a(AFURLSessionManager.o)

I know the files are named differently but the interfaces/implementations are named the same...

@haofanning
Copy link
Author

I'm glad you found the cause of the problem, maybe we should let the maintainer know.

@hughknaus
Copy link

@haofanning the maintainer of cordova-plugin-background-upload has a fork and a PR of cordova-plugin-advanced-http that may just resolve the issue: spoonconsulting/cordova-plugin-background-upload#190 (comment)

@haofanning
Copy link
Author

@hughknaus Great to hear that!Thank you for trying.

@hughknaus
Copy link

PR for main repo: silkimen/cordova-plugin-advanced-http/pull/459

@silkimen
Copy link
Owner

Will be fixed in v3.3.1 Thanks for providing the PR @zafirskthelifehacker! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants