//在视图中加载...
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];
}
}
执行一些线程后,线程没有执行。应用程序挂起。 任何人都可以帮助我。
提前致谢。