我有以下CLLocationManager委托的代码,当我在模拟器上测试它工作得很好,但是当我将它移植到我的ipad时,我得到了一个警告,应用程序冻结了。这是为什么?
- (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,它没有那个警告就可以正常工作
答案 0 :(得分:2)
纬度和经度是双打,而不是字符串等:
[NSString stringWithFormat: @"%d, %d",newLocation.coordinate.latitude,newLocation.coordinate.longitude]