デバッグではまったのでメソッドの交換を試してみた。以下はそのコード。
extension CLLocationManager { func my_requestWhenInUseAuthorization() { print("requestWhenInUseAuthorization") } func my_requestAlwaysAuthorization() { print("requestAlwaysAuthorization") } func switchReq() { sw(from:#selector(requestAlwaysAuthorization), to:#selector(my_requestWhenInUseAuthorization)) sw(from:#selector(requestWhenInUseAuthorization), to:#selector(my_requestWhenInUseAuthorization)) } func sw(from:Selector, to:Selector) { let method = class_getInstanceMethod(CLLocationManager.self, from) let method2 = class_getInstanceMethod(CLLocationManager.self, to) method_exchangeImplementations(method, method2) } }