Xamarin에서 개발 한 iOS 앱에서 NSTimer
을 사용하고 있습니다. 앱이 iOS 10 (iPhone 5S)에서 제대로 작동하지만 iOS 9.3.5와 함께 iPad에서 작동하지 않습니다.
왜 이런 일이 발생하며 어떻게 해결할 수 있습니까?NSTimer - iOS 10에서 작동하지만 iOS에서는 작동하지 않음 9.3
여기에 코드입니다 :
timer = NSTimer.CreateScheduledTimer(0.3, true, delegate
{
List<String> keys = this.beaconRegions.Keys.ToList();
foreach (string identifier in keys)
{
this.locationManager.StopRangingBeacons((CLBeaconRegion)this.beaconRegions[identifier]);
this.locationManager.StopMonitoring(this.beaconRegions[identifier]);
this.locationManager.StartMonitoring(this.beaconRegions[identifier]);
this.locationManager.StartRangingBeacons(this.beaconRegions[identifier]);
}
});
그리고 여기에 충돌 로그 세부입니다 :
4 CoreFoundation 0x21c9a234 0x21c72000 + 164404
5 iBeacon 0x0023564c wrapper_managed_to_native_ObjCRuntime_Messaging_objc_msgSend_intptr_intptr_double_bool_intptr (/<unknown>:1)
6 iBeacon 0x001e8ecc Foundation_NSTimer_CreateScheduledTimer_double_bool_System_Action_1_Foundation_NSTimer (NSTimer.g.cs:134)
7 iBeacon 0x001de5b4 iBeacon_LocationManager_turnOnMonitoring (LocationManager.cs:277)
8 iBeacon 0x001de2ac iBeacon_LocationManager_startMonitoringForBeacons (LocationManager.cs:250)
LocationManager.cs:277
- 이것이 내가 NStimer
에 대한 코드를 코드 라인입니다.
나는 xamarin 녀석이 아니지만 이것이 블록 기반 'NSTimer' API로 변환되는지 궁금합니다. iOS 10에 도입 된 ['scheduledTimer (withTimeInterval : 반복 : 블록 :)'] (https://developer.apple.com/reference/foundation/timer/2091889-scheduledtimer)). 이전' target '/'selector'변환을 지원합니다. – Rob
@Kyll 괜찮아. –