I have used the api isSimulatedBySoftware provided by apple. Its available from iOS 15 onwards.
if #available(iOS 15.0, *) {
// use UICollectionViewCompositionalLayout
let isLocationSimulated = manager.location?.sourceInformation?.isSimulatedBySoftware ?? false
let isProducedByAccess = locationManager.location?.sourceInformation?.isProducedByAccessory ?? false
let info = CLLocationSourceInformation(softwareSimulationState: isLocationSimulated, andExternalAccessoryState: isProducedByAccess)
print("location simulation info \(info)")
if info.isSimulatedBySoftware == true || info.isProducedByAccessory == true{
isSimulatedLocation = true
} else {
isSimulatedLocation = false
}
}
I could detect the location faking using third party application like iAnyGo..