3

I am importing two different Objective-C frameworks FrameworkA and FrameworkB in a sample app MyApp, and those two frameworks define the same Person class.

If you run the MyApp, it gives you the following warning on the console.

objc[27167]: Class Person is implemented in both
    /private/var/containers/Bundle/Application/9762DB63-21E9-4592-B875-
6DF6F373FFD0/MyApp.app/Frameworks/FrameworkA.framework/FrameworkA 
(0x100b18100) and 
    /private/var/containers/Bundle/Application/9762DB63-21E9-
4592-B875-6DF6F373FFD0/MyApp.app/Frameworks/FrameworkB.framework/FrameworkB
 (0x100b30100). 
One of the two will be used. Which one is undefined.

Why do you only get a warning instead of a linker error when (1) there are same class names in two different iOS frameworks? I know (2) having duplicate classes within one framework won't compile because of linker error due to namespace issue.

As far as I know, for both cases, linker links all source codes and libraries/frameworks to one executable. But why doesn't linker throw an error for case (1)?

slow
  • 805
  • 3
  • 13
  • 27
  • I do agree it should a bug with the linker. I think you need to open a bug in the Swift. – Sachin Vas Mar 18 '19 at 05:15
  • 1
    Please have look on the link, https://stackoverflow.com/questions/25231650/swifts-standard-library-and-name-collision – arunjos007 Mar 19 '19 at 06:19
  • Hope it helps, explanation of your problem : https://books.google.ch/books?id=onyzCAAAQBAJ&pg=PA192&lpg=PA192&dq=ios+framework+conflict+same+name&source=bl&ots=p3oKNZ8Yr9&sig=ACfU3U3EX0UT3mJDQOCW2XjciCr-9M_LNA&hl=fr&sa=X&ved=2ahUKEwjioqGPiZHhAhWp5KYKHbIvCQMQ6AEwAXoECAQQAQ#v=onepage&q=ios%20framework%20conflict%20same%20name&f=false – Destrif Mar 20 '19 at 15:51
  • @Destrif I cannot see the preview of the link. Would you mind explaining it? – slow Mar 21 '19 at 00:34
  • @SachinVas Sorry about the confusion. Forgot to mention this was built in Objective-C. – slow Mar 21 '19 at 00:36

0 Answers0