Xcode 8 beta build warning

I'm getting a warning when trying to build my project in Xcode 8. It uses a mix of Objective-C/C++ and Swift 3, and links against some dependencies (Cocoapods). The warning is:


ld: warning: Some object files have incompatible Objective-C category definitions. Some category metadata may be lost. All files containing Objective-C categories should be built using the same compiler.


Does anyone know why this might be happening or how to fix it?

Replies

Got the same warning myself

We have the same issue. Started showing up after migrating the app to Xcode 8 / Swift 3. We did the migrattion during b3 and it still shows up on b4. The app is pure Swift but is linking to several frameworks. Some are also built from source and use Objective-C/C++. Removing DerivedData cnd cleaning ccache didn't help.

Hey guys, I fixed this issue on my build.


After a few hints I found the thing to look for was in my Swift code, where I'd written extension that contained a class var (or a static var?).


I removed this code, did it another way and the warning went away:

extension UICollectionReusableView {

class var defaultReuseIdentifier: String {

return String(describing: self)

}

}


In my case it did little so I deleted and moved the code elsewhere. But I think changing it to a method works too:

extension UICollectionReusableView {

class func defaultReuseIdentifier() -> String {

return String(describing: self)

}

}


The tricky bit is finding where it is in your code because the clang/llvm linker doesn't say.


I suggest just searching your project for "class var" and seeing if it's in an extension.