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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:20:54+00:00 2026-05-26T12:20:54+00:00

I am battling with this piece of code for days now, I really would

  • 0

I am battling with this piece of code for days now, I really would appreciate your insight. So here it is…

fileName which is declared in my .h file as

    NSString *fileName;

and later as

    @property (nonatomic, copy) NSString *fileName;

is not accessible inside viewWillDisappear. It just shows up as nil object, or some weird value when I debug. When I debug, my console show this msg:

Printing description of fileName:
FileNumber1

When I reach to viewWillDisappear my console shows this:

Printing description of fileName:

Yeah, just nothing for fileName.. the value simply disappears.. I just don’t know why!!!

MORE DETAILS:

Inside my init method I do the following and it works fine.

    fileName = [[NSString alloc] initWithString:(NSString *)CFURLGetString(pdfURL)]; 
    fileName = [[fileName lastPathComponent] stringByDeletingPathExtension];
    fileName = [fileName stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

Throughout the program I can access fileName just fine, but inside viewWillDisappear I am trying to save to my standardUserDefaults by attempting the following:

    NSUserDefaults *ud = [[NSUserDefaults standardUserDefaults] autorelease];
    NSArray *tmp = [NSArray arrayWithArray:someMutableArray];
    [ud setObject:tmp forKey:fileName];    // THE PROBLEM IS HERE WITH fileName AS AKEY
    [ud synchronize];
    [tmp release];

At this point someMutableArray is accessible, but fileName is not. Any insight, thoughts, ideas, will be appreciated.

  • 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-26T12:20:54+00:00Added an answer on May 26, 2026 at 12:20 pm

    in your init method change it to read self.fileName =

    You need to use your property methods so that a copy of the string will be made, currently because you are using the variable rather than the property you are assigning an autoreleased string. By using self.fileName the string will be copied and will not be autoreleased.

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

Sidebar

Related Questions

I have been battling with this piece of code for literally days now... Would
I've been battling with this for a few days now with no luck. I've
I've been battling with this issue for a couple of days now. I have
I've been battling this XSL (Saxon/Java) code for several hours now, and still can't
I have been battling this issue for a few days now and think I
For some days i´m battling with this issue: i´m using Jquery to extract data
So I have been battling with this for some time and I need your
So I have been trying and battling with this for a few hours now.
I've been batting this problem around in my head for a few days now
So I have been battling this issue for awhile now and tried many different

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.