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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T08:52:05+00:00 2026-05-21T08:52:05+00:00

The following code for some reason poradically works. I have checked the URL so

  • 0

The following code for some reason poradically works. I have checked the URL so many times it’s not funny (It returns plain text that I would like to parse). The code was 100% functional then it just stopped working and started giving me a EXC_BAD_ACCESS error.

There is nothing in the debugging output to post other than a line saying the output is switching to the process twice. (Except sometimes something about a double release.)

So far (as much as I can remember) I have tried:

  • Reinstalling the app – it only has problems on the ‘Default’ run (not the first Run/initiate Run.)
  • Running the URL in the browser (chrome, firefox, IE…)
  • Putting the call in a @try / @catch block
  • Using retain
  • Using a temp NSAutoreleasePool
  • Splitting up / separating the elements of the call (along with loggin Everything – once it hits the error, nothing gets logged)
  • Using the dataWithContentsOfURL functions with the above

NSAutoreleasePool *tmpPool = [[NSAutoreleasePool alloc] init];

NSString *url_string = [self getNormalVersionDownloadURL];
NSLog(@"urlString: -%@-", url_string);
NSError *er;

NSURL *the_URL = [[NSURL URLWithString:url_string] retain];
NSString *version_String =  [NSString stringWithContentsOfURL:the_URL encoding:NSASCIIStringEncoding error:&er];

NSLog(@"verions_string: -%@-", version_String);

if ([version_String length] < 16)
    return;

[tmpPool release];

(NSAutoreleasePool and autorelease added due to http://discussions.apple.com/thread.jspa?threadID=1667544)

(Cashed page – http://webcache.googleusercontent.com/search?q=cache:8D7zlQdG9PMJ:discussions.apple.com/thread.jspa%3FthreadID%3D1667544+http://discussions.apple.com/thread.jspa%3FthreadID%3D1667544&cd=1&hl=en&ct=clnk&gl=us&source=www.google.com)

  • 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-21T08:52:06+00:00Added an answer on May 21, 2026 at 8:52 am

    discussions.apple.com is currently down so I cannot read the discussion thread. At any rate:


    NSString *url_string = [[self getNormalVersionDownloadURL] autorelease];
    

    Does -getNormalVersionDownloadURL return an owned or a non-owned object? You only send -autorelease if the method returns an owned object.


    NSError **er;
    

    This should be NSError *er instead, or it should be initialised with the address of a variable of type NSError *. Since the latter is uncommon and unnecessary, the following assumes NSError *er.


    NSURL *the_URL = [[NSURL URLWithString:url_string] autorelease];
    

    +URLWithString: returns an NSURL object that you don’t own, hence you don’t (auto)release it.


    version_String = [[NSString stringWithContentsOfURL:the_URL 
        encoding:NSASCIIStringEncoding error:er] autorelease]; //ERROR occurs here
    

    Two problems:: +stringWithContentsOfURL: returns an NSString object that you don’t own, hence you don’t (auto)release it. Furthermore, the third parameter should be &er instead of er.

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

Sidebar

Related Questions

No related questions found

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.