AnsweredAssumed Answered

Assertion Failure in AGSMapView layoutSublayersOfLayer

Question asked by jminnihan on Mar 19, 2013
Latest reply on Jun 3, 2013 by NFurness-esristaff
Hello all,

My ArcGIS 10.1.1 Runtime SDK for iOS project is receiving a Assertion failure inside the layoutSublayersOfLayers method. This is after completion of the viewDidLoad method inside my viewController and before the display of the map upon the iPad 6.1 emulator.

The following is returned inside Xcode's console:

2013-03-19 15:48:17.546 AFSuitability[39547:c07] In viewDidLoad 2013-03-19 15:48:17.550 AFSuitability[39547:c07] Exiting viewDidLoad... 2013-03-19 15:48:17.555 AFSuitability[39547:c07] *** Assertion failure in -[AGSMapView layoutSublayersOfLayer:], /SourceCache/UIKit_Sim/UIKit-2380.17/UIView.m:5776 2013-03-19 15:48:17.556 AFSuitability[39547:c07] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Auto Layout still required after executing -layoutSubviews. AGSMapView's implementation of -layoutSubviews needs to call super.' *** First throw call stack: (0x33a1012 0x2cbde7e 0x33a0e78 0x26e6665 0x1be539f 0x2cd16b0 0x1a3ffc0 0x1a3433c 0x1a3feaf 0x1c842bd 0x1bccb56 0x1bcb66f 0x1bcb589 0x1bca7e4 0x1bca61e 0x1bcb3d9 0x1bce2d2 0x1c7899c 0x1bc5574 0x1bc576f 0x1bc5905 0x1bce917 0x1b9296c 0x1b9394b 0x1ba4cb5 0x1ba5beb 0x1b97698 0x32fcdf9 0x32fcad0 0x3316bf5 0x3316962 0x3347bb6 0x3346f44 0x3346e1b 0x1b9317a 0x1b94ffc 0x227d 0x21a5 0x1) libc++abi.dylib: terminate called throwing an exception

For my UI at the moment, I have a simple AGSMapView set inside a iPad storyboard, with 5 standard iOS UI Buttons drawn on top of the AGSMapView:

Here's my viewController.h:

#import <UIKit/UIKit.h> #import <ArcGIS/ArcGIS.h>  @interface ASViewController : UIViewController <AGSMapViewLayerDelegate, AGSMapViewTouchDelegate> {     AGSMapView *_mapView;     AGSGraphic *_activeGraphic;     AGSSketchGraphicsLayer *_sketchLayer;     AGSGraphicsLayer *_graphicsLayer;     NSString *_currentMode;  }  @property (strong, nonatomic) IBOutlet AGSMapView *mapView; @property (strong, nonatomic) AGSGraphic *activeGraphic; @property AGSSketchGraphicsLayer *sketchLayer; @property AGSGraphicsLayer *graphicsLayer; @property (strong, retain) NSString *currentMode;  @property (weak, nonatomic) IBOutlet UIButton *trackButton; @property (weak, nonatomic) IBOutlet UIButton *lineButton; @property (weak, nonatomic) IBOutlet UIButton *rectButton; @property (weak, nonatomic) IBOutlet UIButton *polyButton; @property (weak, nonatomic) IBOutlet UIButton *circleButton;   - (IBAction)setTrackMode:(id)sender; - (IBAction)setLineMode:(id)sender; - (IBAction)setRectMode:(id)sender; - (IBAction)setPolyMode:(id)sender; - (IBAction)setCircleMode:(id)sender;   @end

and a snippet from my viewController.m:

#import "ASViewController.h"   #define kBaseMapURL @""  @implementation ASViewController  @synthesize activeGraphic = _activeGraphic; @synthesize mapView = _mapView; @synthesize sketchLayer = _sketchLayer; @synthesize graphicsLayer = _graphicsLayer; @synthesize currentMode = _currentMode;   - (void)viewDidLoad {     [super viewDidLoad];     NSLog(@"In viewDidLoad");     // add the base map layer for holding map tiles     NSURL *mapUrl = [NSURL URLWithString:kBaseMapURL];     AGSTiledMapServiceLayer *tiledLayer = [AGSTiledMapServiceLayer tiledMapServiceLayerWithURL:mapUrl];     [_mapView addMapLayer:tiledLayer withName:@"MapTileLayer"];          // add the graphics layer to hold all completed sketches (points, polylines, and polygons)     AGSGraphicsLayer* graphicsLayer = [AGSGraphicsLayer graphicsLayer];     [_mapView addMapLayer:graphicsLayer withName:@"GraphicsLayer"];          // add the sketch layer to hold current user sketch drawing prior to completion     AGSSketchGraphicsLayer* sketchLayer = [[AGSSketchGraphicsLayer alloc] initWithGeometry:nil];     [_mapView addMapLayer:sketchLayer withName:@"SketchLayer"];      _mapView.layerDelegate = self;          // set the ui buttons' selected states     UIImage *btnImage = [UIImage imageNamed:@"bloc.png"];     [self.trackButton setImage:btnImage forState:UIControlStateSelected];     btnImage = [UIImage imageNamed:@"bline.png"];     [self.lineButton setImage:btnImage forState:UIControlStateSelected];     btnImage = [UIImage imageNamed:@"brect.png"];     [self.rectButton setImage:btnImage forState:UIControlStateSelected];     btnImage = [UIImage imageNamed:@"bpoly.png"];     [self.polyButton setImage:btnImage forState:UIControlStateSelected];     btnImage = [UIImage imageNamed:@"bcircle.png"];     [self.circleButton setImage:btnImage forState:UIControlStateSelected];      NSLog(@"Exiting viewDidLoad...");  }