Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7441849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:04:58+00:00 2026-05-29T11:04:58+00:00

This @try-@catch block in my viewDidLoad crashes with EXC_BAD_ACCESS when the return; is executed

  • 0

This @try-@catch block in my viewDidLoad crashes with EXC_BAD_ACCESS when the return; is executed in the catch and the alert doesn’t show either:

    @try
    {        
        errorText = @"thumbnails_array";

        unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:data];
        // Customize unarchiver here
        self.thumbnails_array = [unarchiver decodeObjectForKey:@"thumbnails_array"];
        [unarchiver finishDecoding];
        [unarchiver release];


        errorText = @"ThumbNailViewController";

        archivePath = [app.phojoArchiveDir stringByAppendingPathComponent:@"ThumbNailViewController.archive"];
        data = [NSData dataWithContentsOfFile:archivePath];
        unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:data];
        // Customize unarchiver here
        [unarchiver decodeObjectForKey:@"self"];
        [unarchiver finishDecoding];
        [unarchiver release];

        errorText = @"assetsGroupURL";

        archivePath = [app.phojoArchiveDir stringByAppendingPathComponent:@"assetsGroupURL.archive"];
        data = [NSData dataWithContentsOfFile:archivePath];
        unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:data];
        // Customize unarchiver here
        app.assetsGroupURL = [unarchiver decodeObjectForKey:@"assetsGroupURL"];
        [unarchiver finishDecoding];
        [unarchiver release];


    }
    @catch (NSException *exception) 
    {
       UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Phojo is unable to restore the previous editing session." delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
        [alert show];
        [alert release];

        NSLog(@"Exception %@ thrown while unarchving %@: Reason: %@ Items in userInfo = %d Stack Trace: %@", [exception name], errorText, [exception reason], [[exception userInfo] count], [NSThread callStackSymbols]);  
        [self.thumbnails_array   release];
        self.thumbnails_array = nil;
        [app.assetsGroupURL release];
        app.assetsGroupURL = nil;

        return;


    }

This code is run in the viewDidLoad to retrieve data that have been archived during a previous run of the app. I’ve gotten an exception in this code stating that an archive is uncomprehensible. But with it crashing there is no way to get the app to run at all since it crashes on startup as well on the catch. Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T11:04:59+00:00Added an answer on May 29, 2026 at 11:04 am

    Either your assetsGroupURL or thumbnails_array properties (or both) are declared as retain. That’s fine, but it means that when you call both [self.theProperty release] and self.theProperty = nil, you’re releasing theProperty twice: the second call is using the retain-generated setter and implicitly calling release on its current value as well. Remove the release calls and you should no longer see the EXC_BAD_ACCESS.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I tried to do this: try{ (function($){ ... my plugin stuff })(jQuery); }catch(er){ alert(an
How does a return statement inside a try/catch block work? function example() { try
I've got a strange problem with a try/catch block I'm using. I've got this
I'm using a try-catch block in the following Actionscript 3 code: try { this._subtitle
I have a try-catch block that iterates over a set of records like this:
This article on MSDN states that you can use as many try catch blocks
Why is this code correct: try { } catch(ArrayOutOfBoundsException e) {} and this wrong:
This is a self-explanatory question: Why does this thing bubble into my try catch's
I'm bored with surrounding code with try catch like this.. try { //some boring
Is it better to do this: try { ... } catch (Exception ex) {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.