Extension is not recognized after a bridge from Objective-C to Swift

439 views Asked by At

I have question for expert on Swift and Objective-C. I'm developing on iOS project in swift. In this project, I have import an older owned library (in Objective-C) used with a Objective-C bridge.

When I use some function of this library in my Swift project, I encountered a crash due to unrecognized extension.

The error message is:

-[NSConcreteMutableData AES128EncryptedDataWithKey:]: unrecognized selector sent to instance

This method come from an extension class in my library (NSData+AES128.h) which is not recognized in Swift side. Someone knows how refer this extension in Swift side? I'm really lost!!

Thank you!!

1

There are 1 answers

2
uliwitness On

This is a runtime error, not a compiler/Swift error. So very likely You forgot to add the .m file to your project that implements this category/extension, but the header must obviously be there, as otherwise you'd get compiler warnings about it.