Post

Replies

Boosts

Views

Activity

Can't call some functions in an ObjC category from Swift. Keep getting "Value type has no member" or "Cannot find in scope" errors.
Aargh. I have a category written in Objective-C that adds an equalizer to AVPlayer. I downloaded it from https://github.com/akhilcb/ACBAVPlayerExtension and dragged the relevant source files into my project. I'm sure the target memberships of them are correct. The .H file for the ObjC category starts off like this: @interface AVPlayer(ACBHelper) (void)fooTest; @property (nonatomic, getter=isMeteringEnabled) BOOL meteringEnabled; /* turns level metering on or off. default is off. */ My bridging header .H file definitely has the #import statements to include the category, and I know it's being used because if I put a syntax error in there as a test, I get an error. I cannot get past this error in my code: "Value of type 'AVPlayer' has no member 'isMeteringEnabled" with these lines: self.player = AVPlayer(playerItem: playerItem) self.player.meteringEnabled = true I tried using meteringEnabled and isMeteringEnabled with no success. As an experiment, I added fooTest() to the category just to see if I can call it. I try to call it like this from Swift: self.player.fooTest() I keep getting an error "Value of type AVPlayer has no member fooTest which is nonsense. fooTest shows up in autocomplete. Also, if I right-click on fooTest in the line that says self.player.foohTest(), and select Jump to Definition, I am taken to the .H file and the line where I added - (void)fooTest;
4
0
599
Apr ’21