FlagPhoneNumber
FlagPhoneNumber copied to clipboard
conforming to FPNTextFieldDelegate leads to Build error 'duplicate symbols' when build with other pods
Describe the bug I have couple of frameworks already included in my project, and now I'm adding 'FlagPhoneNumber' using cocoa pods.
After updating pods, app builds fine and I can use FlagPhoneNumber, but as soon as I confirm to FlagPhoneNumberDelegate to validate phone number; build fails
Error Log
duplicate symbol '_kPhoneNumberMetaDataExpandedLength' in: /Users/nagesh/Library/Developer/Xcode/DerivedData/App-azmlnulobwzbyldoryfxtfkucgqc/Build/Intermediates.noindex/App.build/Debug-iphonesimulator/App.build/Objects-normal/x86_64/EDCMapboxViewController.o /Users/nagesh/Library/Developer/Xcode/DerivedData/App-azmlnulobwzbyldoryfxtfkucgqc/Build/Intermediates.noindex/App.build/Debug-iphonesimulator/App.build/Objects-normal/x86_64/EDCSortFilterViewController.o duplicate symbol '_kPhoneNumberMetaData' in: /Users/nagesh/Library/Developer/Xcode/DerivedData/App-azmlnulobwzbyldoryfxtfkucgqc/Build/Intermediates.noindex/App.build/Debug-iphonesimulator/App.build/Objects-normal/x86_64/EDCMapboxViewController.o /Users/nagesh/Library/Developer/Xcode/DerivedData/App-azmlnulobwzbyldoryfxtfkucgqc/Build/Intermediates.noindex/App.build/Debug-iphonesimulator/App.build/Objects-normal/x86_64/EDCSortFilterViewController.o duplicate symbol '_kPhoneNumberMetaDataCompressedLength' in: /Users/nagesh/Library/Developer/Xcode/DerivedData/App-azmlnulobwzbyldoryfxtfkucgqc/Build/Intermediates.noindex/App.build/Debug-iphonesimulator/App.build/Objects-normal/x86_64/EDCMapboxViewController.o /Users/nagesh/Library/Developer/Xcode/DerivedData/App-azmlnulobwzbyldoryfxtfkucgqc/Build/Intermediates.noindex/App.build/Debug-iphonesimulator/App.build/Objects-normal/x86_64/EDCAuditMapCollectionViewCell.o duplicate symbol '_kPhoneNumberMetaDataExpandedLength' in: /Users/nagesh/Library/Developer/Xcode/DerivedData/App-azmlnulobwzbyldoryfxtfkucgqc/Build/Intermediates.noindex/App.build/Debug-iphonesimulator/App.build/Objects-normal/x86_64/EDCMapboxViewController.o /Users/nagesh/Library/Developer/Xcode/DerivedData/App-azmlnulobwzbyldoryfxtfkucgqc/Build/Intermediates.noindex/App.build/Debug-iphonesimulator/App.build/Objects-normal/x86_64/EDCAuditMapCollectionViewCell.o duplicate symbol '_kPhoneNumberMetaData' in: /Users/nagesh/Library/Developer/Xcode/DerivedData/App-azmlnulobwzbyldoryfxtfkucgqc/Build/Intermediates.noindex/App.build/Debug-iphonesimulator/App.build/Objects-normal/x86_64/EDCMapboxViewController.o /Users/nagesh/Library/Developer/Xcode/DerivedData/App-azmlnulobwzbyldoryfxtfkucgqc/Build/Intermediates.noindex/App.build/Debug-iphonesimulator/App.build/Objects-normal/x86_64/EDCAuditMapCollectionViewCell.o ld: 858 duplicate symbols for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
Screenshots
Smartphone (please complete the following information):
- Device: Simulator
- OS: iOS
- Version 12
FlagPhoneNumber (please complete the following information):
- Version 0.7.6
Additional context I have created a demo app only with 'FlagPhoneNumber' pods without any other pods, it works!
Did you try to clean your project + remove DerivedData repository and rebuild ?
@grifas I did, it didn't help. It seems issues started when 'FPNTextFieldDelegate' has been updated to support Objective-C. i.e adding "@objc" keyword for the delegate. Because I downgraded to the version without "@objc" and it builds.
It seems your files (EDCMapboxViewController, EDCSortFilterViewController and EDCAuditMapCollectionViewCell) are duplicate so check in Build Phases
and delete it.
858 duplicate symbols for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
It's not only those files, it is saying all of my source files are duplicated.
@mobiniusnagesh did you end up figuring out what was causing this?
I have the same issue, and I believe it's because I use a mixed Objective-C Swift project. All of the duplicate symbols
warnings are on files that I have a project-swift.h import in the objective-c class.
Yes.. I just downgraded the library to the version where it does not have ‘@objc’ annotation for the delegates. I don’t remember the extract version, because I’m no longer working on that. Hope this helps
@mobiniusnagesh can you please share the version number you downgraded to?
Any solution for duplicate symbols, i want to use in objective c project
I fixed the issue by forking the project and removing the @objc
marker from the delegate. I have a mixed ObjC/Swift project, but only need to use the library from Swift controllers. You can either check out my fork or make the same change yourself. I followed the instructions from this Stack Overflow question to use my forked branch with CocoaPods
.
Edit: it also worked to use an earlier version, 0.7.4, but then you also miss out on some of the updates to the library.