由于ipad/iphone上的未捕获异常而终止应用程序
我从这个例行程序(iAction)curr:(id)发送方收到一个崩溃。 所以我可以确定哪个按钮叫它。 当我按下调用上述方法(curr)的按钮时发生崩溃。 它最终必须显示当前的用户位置,但在显示纬度和经度后立即崩溃。 以字符串形式接收数据由于ipad/iphone上的未捕获异常而终止应用程序,iphone,ios,Iphone,Ios,我从这个例行程序(iAction)curr:(id)发送方收到一个崩溃。 所以我可以确定哪个按钮叫它。 当我按下调用上述方法(curr)的按钮时发生崩溃。 它最终必须显示当前的用户位置,但在显示纬度和经度后立即崩溃。 以字符串形式接收数据 { Error = "Lat must be provided"; Success = 0; } 它引发异常:由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:'-[\uu NSCFDictionary objec
{
Error = "Lat must be provided";
Success = 0;
}
它引发异常:由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:'-[\uu NSCFDictionary objectAtIndex::]:未识别的选择器发送到实例0x6e20000'
这是我的密码:
-(IBAction)curr:(id)sender
{
count=0;
NSLog(@"fhfg");
NSLog(@"%@",latu);
NSLog(@"%@",longs);
locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
locationManager.distanceFilter = kCLDistanceFilterNone; // whenever we move
locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters; // 100 m
[locationManager startUpdatingLocation];
}
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation
{
if (count==0)
{
int degrees = newLocation.coordinate.latitude;
double decimal = fabs(newLocation.coordinate.latitude - degrees);
int minutes = decimal * 60;
double seconds = decimal * 3600 - minutes * 60;
latu= [NSString stringWithFormat:@"%d° %d' %1.4f\"", degrees, minutes, seconds];
//a=latu;
NSLog(@" Current Latitude : %@",latu);
//latLabel.text = lat;
degrees = newLocation.coordinate.longitude;
decimal = fabs(newLocation.coordinate.longitude - degrees);
minutes = decimal * 60;
seconds = decimal * 3600 - minutes * 60;
longs = [NSString stringWithFormat:@"%d° %d' %1.4f\"", degrees, minutes, seconds];
NSLog(@" Current Longitude : %@",longs);
}
}
您可以通过右键单击first responder cube符号来检查.xib文件和first responder。
如果first responder connect outlets中有任何警告符号,那么这就是应用程序崩溃的原因。学习在代码中设置断点,并使用XCode提供的调试工具。他们在那里是有原因的。他们会帮助你的。你将能够自己解决这样的问题。为什么会有这么多的问题被发布在网站上,以至于人们还没有基本尝试使用这些调试工具呢?是的,没错……设置断点,然后找出那个狗屎在哪里