发布代码的流程与调试不同吗?

时间:2009-12-11 19:27:14

标签: iphone xcode

当我在设备发布模式下运行此代码时,它会在“[mapView setRegion:region animated:TRUE]”上拉出“SIGABRT”;“线。但是,我在调试或模拟器模式下都没有遇到问题。

我是xcode的新手。我做错了什么?

- (void)initUI {
// add a map view in available area
startupPage = [[CSNet alloc] init];
positionUpdatePage = [[CSNet alloc] init];
opponentsPage = [[CSNet alloc] init];
firePage = [[CSNet alloc] init];
checkinPage = [[CSNet alloc] init];
[self getStartup:FALSE];
UIImage *blueButton = [[UIImage imageNamed:@"blueButton.png"] stretchableImageWithLeftCapWidth:12.0f topCapHeight:0.0f];
UIImage *redButton = [[UIImage imageNamed:@"redButton.png"] stretchableImageWithLeftCapWidth:12.0f topCapHeight:0.0f];
UIImage *gpsImage = [UIImage imageNamed:@"gps_icon.png"];
[self initSounds];
[gpsButton setBackgroundImage:gpsImage forState:UIControlStateNormal];
[settingsButton setBackgroundImage:blueButton forState:UIControlStateNormal];
[joinButton setBackgroundImage:blueButton forState:UIControlStateNormal];
[fireButton setBackgroundImage:redButton forState:UIControlStateNormal];
[self UpdateIndicators];
MKCoordinateRegion region;
region.span.latitudeDelta = [appDelegate.savedSpanLatitude floatValue];
region.center.latitude = [appDelegate.savedLatitude floatValue];
region.center.longitude = [appDelegate.savedLongitude floatValue];
mapHeight = self.view.frame.size.height; // - 50;
mapView = [[MKMapView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, mapHeight)];
// viewtouch catches events on map
viewTouch = [[CSViewTouch alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, mapHeight)];
viewTouch.multipleTouchEnabled = TRUE;
[self.view insertSubview:mapView atIndex:0];
[mapView setDelegate:self];
mapType.selectedSegmentIndex = [appDelegate.savedMapViewType intValue];
[mapView setRegion:region animated:TRUE];

2 个答案:

答案 0 :(得分:1)

您从未在上面的代码中设置region.span.longitudeDelta。我建议使用MKCoordinateRegionMake函数来设置这两个值和两个增量,这样你就不会得到陈旧或随机的值。

答案 1 :(得分:0)

Jason的评论准确且有用 - 如果可能的话,我会“检查”它。我的发布代码表现不同。一旦我查看堆栈(感谢提示,Jason),我意识到当mapView设置为longitudeDelta为0时代码错误。此行为似乎不仅在调试/发布和设备/模拟器之间有所不同,而且显然是裁剪的在最新的iPhone OS中。

相关问题