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

The Archive Base Latest Questions

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

in my iPhone app I’m using file manager to check size of file,code is

  • 0

in my iPhone app I’m using file manager to check size of file,code is working fine on simulator, but when I run the same app on iphone it is saying file size is zero even though file size is greater than zero, I am using following code:

NSArray *paths1 = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory1 = [paths1 objectAtIndex:0];
documentsDirectory1 = [documentsDirectory1 stringByAppendingPathComponent:@"XML"];
NSString * szDestPath1 = [documentsDirectory1 stringByAppendingPathComponent:@"Extras"];
NSString *URL2 = [szDestPath1 stringByAppendingPathComponent:@"config.xml"];


NSLog(@"%@",URL2);
NSError *attributesError = nil;
NSDictionary *fileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:URL2 error:&attributesError];

int _fileSize = [fileAttributes fileSize];

NSLog(@"_fileSize:%U",_fileSize); //0 if empty

How can I solve this, can anyone help me? thanx in advance.

  • 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-20T22:26:29+00:00Added an answer on May 20, 2026 at 10:26 pm

    Are you sure that the file exists?

    Usually if a piece of code that involves files works fine on the simulator but not on the device it is because of wrong filenames. Most simulators run on a case-insensitive filesystem, but the device has a case-sensitive filesystem.

    So please check again if you use the correct file path.

    You could add something like this to make sure that the file exists:

    if (![[NSFileManager defaultManager] fileExistsAtPath:URL2]) {
        NSLog(@"File does not exist");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My iPhone app rotates fine in the simulator but when I deploy it on
I have an iPhone app that compiles and runs fine in the Simulator on
Our iPhone app code currently uses NSURLConnection sendSynchronousRequest and that works fine except we
My iPhone app was running fine. I added a component to my xib file
My iPhone app is crashing and getting EXC_BAD_ACCESS error when using this code: NSError
In an iPhone app I'm working on, the user needs to enter some configuration
The sound for my iPhone app worked fine when I was running iPhone OS
The iPhone app I'm working on uses html help files and special characters such
My iphone app writes key-value pairs to a dictionary in a plist file. I'm
The iPhone app that I am working on requires GET calls to a 3rd

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.