當我在設備發佈模式下運行此代碼時,它會在「[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];
您的主要問題的答案是:是的,它可以並且通常是由於優化。至於你的暗示性問題,「爲什麼我在這裏中止?」我不確定。什麼是您的堆棧的回溯,以及正在生成的異常(如果有的話)? – 2009-12-11 19:32:25