2011-04-05 73 views
0

我有以下代碼爲CLLocationManager委託,當我在模擬器上測試它工作得很好,但是當我將它移植到我的iPad時,我得到了一個警告,應用程序凍結。爲什麼是這樣?UIAlertView設備上的問題

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation 
{ 


    UIAlertView *alert = [[UIAlertView alloc] 
          initWithTitle: @"Pinging GPS" 
          message: [NSString stringWithFormat: @"%@, %@",newLocation.coordinate.latitude,newLocation.coordinate.longitude] 
          delegate: nil 
          cancelButtonTitle:@"OK" 
          otherButtonTitles:nil]; 

    NSString * newAudioFile = [[NSBundle mainBundle] pathForResource:@"enter" ofType:@"mp3"]; 
    AVAudioPlayer * av = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:newAudioFile] error:NULL]; 
    [av play]; 
    [alert show]; 
    [alert release]; 

} 

我得到的警告是:

warning: Unable to read symbols for /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.3.1 (8G4)/Symbols/Developer/usr/lib/libXcodeDebuggerSupport.dylib (file not found). 

如果我刪除了UIAlertView中,它工作得很好而沒有警告

回答

2

緯度和經度是雙打,而不是字符串或這樣的:

[NSString stringWithFormat: @"%d, %d",newLocation.coordinate.latitude,newLocation.coordinate.longitude] 
+0

事實證明,問題是我在函數中有一個stopMonitoringForRegion,但是,謝謝你指出這一點 – aherlambang 2011-04-05 04:28:22