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

  • SEARCH
  • Home
  • 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 8050319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:03:45+00:00 2026-06-05T07:03:45+00:00

I have an error getting passed by reference to some code I found online.

  • 0

I have an error getting passed by reference to some code I found online. The error comes back as an empty object meaning there was no error.

if I check for error.code I get a bad access because the object is empty.

if I check for error == nil I get a false because error is an empty object.

How can I use logic to find that the error exists, but is empty?

  • 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-06-05T07:03:47+00:00Added an answer on June 5, 2026 at 7:03 am

    Errors are usually of type NSError or a subclass of it. They are passed as references in methods declared this way:

    -(void)DoSomeStuff:(NSError **)error;
    

    So, when you call a method that requires you to pass a reference to a NSError you call it this way:

    NSError *error = nil;
    [self DoSomeStuff:&error];
    

    When this method finished its work you check if the error object has actually filled with something:

    if(error)
    {
       //Do some stuff if there is an error.
       //To see the human readable description you can:
       NSLog(@"The error was: %@", [error localizedDescription]);
       //To see the error code you do:
       NSLog(@"The error code: %d", error.code);
    }
    else //There is no error you proceed as normal
    {
      //Do some other stuff - no error
    }
    

    P.S. If you get no error and the method does not behave as expected then there is something wrong with the implementation with this method. Especially if it’s an open source stuff, coding mistakes can easily appear, so you can take a look at what the method does, debug and even fix if something is wrong…

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

Sidebar

Related Questions

I keep getting this error from my code and I have no idea what
I am getting ERROR 1064 (42000): You have an error in your SQL syntax;
I keep getting the following error message ERROR 1064 (42000): You have an error
I am getting error of System.MissingMethodException after I have an optional parameter in one
I have coded a nice script but i am constantly getting Error on line
I want AddContentViewController to have two delegate, but keeping getting error, how can I
I have been getting this error: 'unresolved external symbol main referenced in function _
I keep getting this error and i have been trying everything for about a
I keep getting this error and I have tried putting quotes around the actual
im getting this error but I have no idea why its happening. It stops

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.