Note that there are some explanatory texts on larger screens.

plurals
  1. POEXC_BAD_ACCESS on iPhone (with debugger screenshot)
    primarykey
    data
    text
    <p>I'm developing an iPhone application that show the camera's view with this code:</p> <pre><code>-(void) displayAR { [rootViewController presentModalViewController:[self cameraController] animated:NO]; [displayView setFrame:[[[self cameraController] view] bounds]]; } </code></pre> <p>And hide the camera's view with this code:</p> <pre><code>- (void) hideAR { [[self locationManager] stopUpdatingHeading]; [[self locationManager] stopUpdatingLocation]; [[self accelerometerManager] release]; [rootViewController dismissModalViewControllerAnimated:YES]; } </code></pre> <p>When I call hideAR, I get an EXC_BAD_ACCESS with the following debugger screenshot:</p> <p><a href="http://img408.imageshack.us/img408/4550/capturadepantalla201006u.png" rel="nofollow noreferrer">alt text http://img408.imageshack.us/img408/4550/capturadepantalla201006u.png</a></p> <p>Any advice?</p> <p><strong>UPDATE:</strong><br /></p> <p>I've changed hideAR code with this and I'm getting the same error:</p> <pre><code>- (void) hideAR { [rootViewController dismissModalViewControllerAnimated:YES]; } </code></pre> <p>I've checked rootViewController and it isn't nil.</p> <p>As you can see on debugger's screenshot, the last method called (the first on the stack) is: <code>[UIWindowController transitionViewDidComplete:fromView:toView]</code>.</p> <p>Maybe, there is something accessing camera´s view after it was dismissed.</p> <p><strong>SECOND UPDATE</strong><br /></p> <p>The class containing these methods is:</p> <pre><code>@implementation AugmentedRealityController @synthesize locationManager; @synthesize accelerometerManager; @synthesize displayView; @synthesize centerCoordinate; @synthesize scaleViewsBasedOnDistance; @synthesize rotateViewsBasedOnPerspective; @synthesize maximumScaleDistance; @synthesize minimumScaleFactor; @synthesize maximumRotationAngle; @synthesize centerLocation; @synthesize coordinates = coordinates; @synthesize debugMode; @synthesize currentOrientation; @synthesize degreeRange; @synthesize rootViewController; @synthesize cameraController; - (id)initWithViewController:(UIViewController *)vc { coordinates = [[NSMutableArray alloc] init]; coordinateViews = [[NSMutableArray alloc] init]; latestHeading = -1.0f; debugView = nil; [self setRootViewController: vc]; [self setDebugMode:NO]; [self setMaximumScaleDistance: 0.0]; [self setMinimumScaleFactor: 1.0]; [self setScaleViewsBasedOnDistance: NO]; [self setRotateViewsBasedOnPerspective: NO]; [self setMaximumRotationAngle: M_PI / 6.0]; CGRect screenRect = [[UIScreen mainScreen] bounds]; [self setDisplayView: [[UIView alloc] initWithFrame: screenRect]]; [self setCurrentOrientation:UIDeviceOrientationPortrait]; [self setDegreeRange:[[self displayView] bounds].size.width / 12]; [vc setView:displayView]; [self setCameraController: [[[UIImagePickerController alloc] init] autorelease]]; [[self cameraController] setSourceType: UIImagePickerControllerSourceTypeCamera]; [[self cameraController] setCameraViewTransform: CGAffineTransformScale([[self cameraController] cameraViewTransform], 1.13f, 1.13f)]; [[self cameraController] setShowsCameraControls:NO]; [[self cameraController] setNavigationBarHidden:YES]; [[self cameraController] setCameraOverlayView:displayView]; CLLocation *newCenter = [[CLLocation alloc] initWithLatitude:37.41711 longitude:-122.02528]; [self setCenterLocation: newCenter]; [newCenter release]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deviceOrientationDidChange:) name: UIDeviceOrientationDidChangeNotification object:nil]; [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; // Inicializa el gestor del GPS y el del acelerómetro. [self startListening]; return self; } </code></pre> <p><strong>THIRD UPDATE</strong><br /></p> <p>I've put some NSLog trace, and I see that displayAR is called after hideAR call. I also see that <code>viewDidAppear</code> method on <code>rootViewController</code> is also called after hideAR. Actually, <code>viewDidAppear</code> is calling <code>displayAR</code>.</p> <p><strong>Why is called viewDidAppear?</strong></p> <p><strong>FOURTH UPDATE</strong><br /></p> <p>I've found the line that is failing. This is the first line on <code>displayAR</code>:</p> <pre><code>[rootViewController presentModalViewController:[self cameraController] animated:NO]; </code></pre> <p><strong>Any ideas?</strong> <code>rootViewController</code> and <code>cameraController</code> aren't nil.</p> <p><strong>FITH UPDATE</strong><br /></p> <p>If you want to reproduce my error:</p> <p>I'm using nielswh's iPhone-AR-Toolkit (you can download it <a href="http://github.com/nielswh/iPhone-AR-Toolkit/tree/staticlibrary" rel="nofollow noreferrer">here</a>).</p> <p>You can modify the ARKitDemo example include it with the library and try to dismissModalView.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload