I’m getting an error in XCode:
multiple methods named ‘setEnabled’ found with mismatched result, parameter type, or attributes
I’m using the following code within AppDelegate.m:
#import "BluetoothManager.h"
Class BluetoothManager = objc_getClass( "BluetoothManager" ) ;
id btCont = [BluetoothManager sharedInstance] ;
[btCont setEnabled:!currentState] ;
if you’re importing
BluetoothManager.hthen you have it resolved at compile-time, adjust the code to say:are you trying to support a new class, but also run in older iOS?
in response to Q1: the “simple” version, if you’re not trying to do anything tricky, is to forego the
objc_getClasswhich provides dynamic flexibility that is not often neededThis assumes:
BluetoothManageris declared in “BluetoothManager.h”+sharedInstance(which to follow common Objective-C naming conventions, I would rename to+sharedBluetoothManager)-setEnabled: