Xcode 12 different definitions in different modules build error

In the Xcode 12 betas I'm seeing an issue with importing Swift modules with @objc annotations.

Given two Swift modules which expose classes of the same name:

Code Block
// FrameworkOne
@objc
public class Thing: NSObject {
public override init() {}
@objc
public func doSomething() {}
}


Code Block
// FrameworkTwo
@objc
public class Thing: NSObject {
public override init() {}
@objc
public func doSomethingElse() {}
}


And if I have imported both of the frameworks into an ObjC file and interact with the classes in either of them:

Code Block
#import <Foundation/Foundation.h>
@import FrameworkOneObjC;
@import FrameworkTwoObjC;
@interface Example : NSObject
@end
@implementation Example
- (void) example
{
Thing *thing = [[Thing alloc] init];
}
@end


Then I'm seeing this build error:
Code Block
'Thing' has different definitions in different modules; first difference is definition in module 'FrameworkOne.Swift' found method name 'doSomething'
But in 'FrameworkTwo.Swift' found method name 'doSomethingElse'


Is this expected behaviour? If so, is there any way to opt out?

In my case FrameworkOne & FrameworkTwo are external dependencies, and I'm unable to change the names of the classes.
Is there any solution to this?
Is there any solution to this? 快点呀,这个大的问题,还怎么升级改bug
Is there any solution on this please fix this ASAP.
I'm not able to run the project in Xcode 12 due to this same class in different framework.
Same exception for me and project could not be compiled.

Xcode 12 conflicted frameworks;
ReactiveObjC

'Operations' with definition in module 'ReactiveObjC.RACStream' has different definitions in different modules; first difference is this method
Still having this issue on Xcode 12.0.
Hello Apple Team,

Do we get any reply on this issue?
Look up every day and see if you've solved the problem Come on, Daddy Apple

每天上来看一下,看到底解决问题了么,快点呀,苹果爸爸
Seeing this in Xcode 12.0.1.
Still exists in Xcode 12.0.1
For what it's worth, these steps helped me to fix this issue.
  • Open the project and clean the build folder

  • Close Xcode completely

  • Clear derived data

  • Empty mac bin

  • Start Xcode and clean build folder again

  • Build succeeded without any error and able to run on device.

Sidenote: I have to repeat these steps every day.

still waiting for a solution . My Pods "Macaw" and "CometChatPro" has both a class named Group and other super classes so I get. an Compiler Error
We have exactly the same issue after upgrading to Xcode 12. Apple, is there a solution to this please?
Same here, I have to use Xcode 12.0.1 but I have these incompatibilities.

Having two classes with the same names from two independent librairies should definitely not be an issue, a fix would be appreciated.
same on xcode 12 (12.0.1 (12A7300))
nothing of these helps:
  • cleaning build/derived data/recycle bin/restarting mac

  • pod deintegrate && pod install

  • using legacy build system

To author and everyone complaining here, what behaviour do you expect if there was no error? There is a clear ambiguity, objc compiler doesn't know which class to choose. If there was no error previously, that means that compiler choses one of those classes via some internal, undocumented way, that can lead to faulty and unexpected behaviour.

To solve this issue you can either change objc names to have prefixes (which is a way to resolve namespacing in objc, and definitely should be done in good third party libs):
Code Block
// FrameworkOne
@objc(ABCThing)
public class Thing: NSObject { ... }
// FrameworkTwo
@objc(XYZThing)
public class Thing: NSObject { ... }

Or, if you don't have any way to affect this code, you have to avoid importing both frameworks at the same time when you referencing an ambiguous definitions.
Xcode 12 different definitions in different modules build error
 
 
Q