2012-08-15 41 views
1

任何人都可以告訴我爲什麼這段代碼沒有被執行嗎?我從我的另一個項目中複製並粘貼它,在那裏它工作得很好。我也在我的其他應用程序中使用了相同的地址串,我在這裏插入,並且它完美地工作。但它發生OLY同時傳遞字符串變量,如果我通過了地址直接geocodeaddressstring它工作正常iOS正向地理編碼未被執行

NSString *addressString = @"2642 Broadway, New York, NY 10025, USA"; 
[forwardGeocoder1 geocodeAddressString:addressString 
          completionHandler:^(NSArray *placemarks, NSError *error){ 

           // Make sure the geocoder did not produce an error 
           // before continuing 
           if(!error){ 

            // Iterate through all of the placemarks returned 
            // and output them to the console 
            for(CLPlacemark *placemark in placemarks){ 

           NSLog(@"found"); 

            } 
           } 
           else{ 
            // Our geocoder had an error, output a message 
            // to the console 
            NSLog(@"There was a forward geocoding error\n%@", 
             [error localizedDescription]); 
           } 
          } 
     ]; 

錯誤:
kCLErrorDomain錯誤8.

回答

1

請參閱本documentation

按照文檔,kCLErrorDomain error 8的意思是:kCLErrorGeocodeFoundNoResult

+0

如果我通過這樣的地址NSString * addressString = [addressArray objectatindex:0]; 那麼只有得到上述錯誤 – Arvind 2012-08-15 15:52:00

+0

@Arvind,請粘貼您的完整代碼。這將有助於瞭解情況。 – 2012-08-15 17:45:28