2011-04-05 70 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