XCode 12: 'SessionDelegate' has different definitions in different modules XCode 12: 'SessionDelegate' has different definitions in different modules xcode xcode

XCode 12: 'SessionDelegate' has different definitions in different modules


You can try SWIFT_INSTALL_OBJC_HEADER = NO, it works for me

enter image description here


At this moment (Xcode 12.0 or Xcode 12.2b2), the only possible solution is to rename the Objective-C interface and avoid conflicts. This could be done by one of:

  • Rename conflicting class entirely, update all places where it's used (e.g. replace SessionDelegate by KingfisherSessionDelegate)
  • Add @objc(...) attribute to a Swift class, which will update the Obj-C interface in a generated ...-Swift.h file and avoid the names conflict.
//  SessionDelegate.swift@objc(KFSessionDelegate)class SessionDelegate: NSObject { ... }
//  Kingfisher-Swift.h@interface KFSessionDelegate : NSObject...@end

This solution is already included in the Kingfisher 5.15.4 release and could be applied to any other libraries and your own frameworks.

Also, the thread on Apple forums: https://developer.apple.com/forums/thread/658012


The error is saying that you have multiple classes with the same name SessionDelegate in different modules. This error is related to Xcode 12.

For now, a quick solution is to install the module with CocoaPods (if you're using Carthage) and if needed, rename the SessionDelegate interface.