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 7034909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:14:31+00:00 2026-05-28T01:14:31+00:00

This is a simple Objective-C question. When you use a @try the work flow

  • 0

This is a simple Objective-C question.

When you use a @trythe work flow can run in 2 ways

  • If some NSException appear, the code immediately jump to @catch block and than to @finally
  • If not, finish to run the @try block and than run @finally

So, what is the difference to use or not use the @finally block? If I use only:

-(void)function{
    @try {
     ...
    }
    @catch (NSException *exception) {
     ...
    }
    >>>The workflow will run this line in any case?
}

Than the rest of the function will run, or only the @catch block if a NSException is created?

  • 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-28T01:14:32+00:00Added an answer on May 28, 2026 at 1:14 am

    “A @finally block contains code that must be executed whether an exception is thrown or not.”
    Does code in finally get run after a return in Objective-C?

    The finally block exists to release/clean up resources like open sockets, open files, database locks, semaphore locks, and so on.

    If an error occurs inside of the catch block or the catch block rethrows the exception, then the line:

    >>>The workflow will run this line in any case?
    

    is not executed. However, the code in the finally block should be executed. The finally block is the last, best chance to exit cleanly from an application that is about to crash. Even if the application is not about to crash, it is still the best place to cleanup resources because the code inside the finally block is more likely to be executed under unexpected conditions than code outside of the finally block.

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

Sidebar

Related Questions

As a continuation of this question I'm wondering if I can get some simple
I'm new with Objective-C, so there probably is a simple solution to this. I
I've searched all over for an answer to this simple question, with no luck.
I think this is a very simple question, but I’m new to programming so
Being fairly new to iPhone / Objective-C development, I wanted to ask this question
This isn't a style question. Its more about the proper use of the language
This is probably not a simple question so I am not looking for a
This might seem like a very simple question, but I am struggling with it.
I wrote a simple program to understand how objective-c works. This program is the
I've got a simple question about objective-c. I've been taught to lazily instantiate my

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.