FlagPhoneNumber icon indicating copy to clipboard operation
FlagPhoneNumber copied to clipboard

conforming to FPNTextFieldDelegate leads to Build error 'duplicate symbols' when build with other pods

Open mobiniusnagesh opened this issue 5 years ago • 9 comments

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 Screenshot 2019-07-12 at 11 20 26 am Screenshot 2019-07-12 at 11 19 49 am

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!

mobiniusnagesh avatar Jul 12 '19 06:07 mobiniusnagesh

Did you try to clean your project + remove DerivedData repository and rebuild ?

grifas avatar Jul 12 '19 07:07 grifas

@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.

mobiniusnagesh avatar Jul 15 '19 07:07 mobiniusnagesh

It seems your files (EDCMapboxViewController, EDCSortFilterViewController and EDCAuditMapCollectionViewCell) are duplicate so check in Build Phases and delete it.

grifas avatar Jul 15 '19 07:07 grifas

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 avatar Jul 15 '19 07:07 mobiniusnagesh

@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.

inottawa avatar Aug 02 '19 00:08 inottawa

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 avatar Aug 03 '19 10:08 mobiniusnagesh

@mobiniusnagesh can you please share the version number you downgraded to?

wazzah-marham avatar Oct 28 '20 13:10 wazzah-marham

Any solution for duplicate symbols, i want to use in objective c project

awais-shahid avatar Feb 24 '21 09:02 awais-shahid

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 Remove @objc from delegate . 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.

mdstone06 avatar Mar 17 '22 17:03 mdstone06