我知道它与锁或调度组有关,但我似乎无法对其进行编码......
在离开该方法之前,我需要知道该地址是否为有效地址。当前线程刚刚溢出并返回 TRUE。我试过锁,调度员工作,但似乎无法正确。任何帮助表示赞赏:
- (BOOL) checkAddressIsReal
{
__block BOOL result = TRUE;
// Lets Build the address
NSString *location = [NSString stringWithFormat:@" %@ %@, %@, %@, %@", streetNumberText.text, streetNameText.text, townNameText.text, cityNameText.text, countryNameText.text];
// Put a pin on it if it is valid
CLGeocoder *geocoder = [[CLGeocoder alloc] init];
[geocoder geocodeAddressString:location
completionHandler:^(NSArray* placemarks, NSError* error) {
result = [placemarks count] != 0;
}];
return result;
}