//在视图中确实加载了...
self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;
self.locationManager.distanceFilter = kCLHeadingFilterNone;// kCLHeadingFilterNone;
self.locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation;
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
if (newLocation.course >= 0)
{
[NSThread detachNewThreadSelector:@selector(showAlertsIfNeededThread) toTarget:self withObject:nil];
}
}
- (void) showAlertsIfNeededThread
{
@autoreleasepool
{
NSLog(@"Thread started........");
[NSThread sleepForTimeInterval:3.0];
//[self showAlertsIfNeeded];
[self performSelectorOnMainThread:@selector(showAlertsIfNeeded) withObject:nil waitUntilDone:NO];
}
}
在一些执行之后,线程没有执行。应用程序挂起。谁能帮我吗。
提前致谢。