开发者

Does release code flow differently from debug?

开发者 https://www.devze.com 2022-12-13 16:57 出处:网络
When I run this code in device release mode, it pulls a \"SIGABRT\" on the \"[mapView setRegion:region animated:TRUE];\" line.However, I don\'t get the problem in either d开发者_JS百科ebug or simulato

When I run this code in device release mode, it pulls a "SIGABRT" on the "[mapView setRegion:region animated:TRUE];" line. However, I don't get the problem in either d开发者_JS百科ebug or simulator mode.

I'm a novice in xcode. What am I doing wrong?

- (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];


You never set the region.span.longitudeDelta in the above code. I'd recommend using the MKCoordinateRegionMake function to set both values and both deltas, so you don't end up with stale or random values.


Jason's comment was accurate and helpful - I'd "check" it if possible. My release code is behaving differently. Once that I looked at the stack (thanks for the hint, Jason), I realized the code bugs out when mapView is set to longitudeDelta of 0. This behavior appears to not only differ between debug/release and device/simulator, but apparently cropped up in the most recent iPhone OS.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号