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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:49:25+00:00 2026-05-20T11:49:25+00:00

I wonder if any of you could help with this problem. The following code

  • 0

I wonder if any of you could help with this problem. The following code is trying to access an audio file ‘4sSweepReverse.wav’ at a path location determined and contained within the char *path. This code works absolutely fine when run in the simulator, but does not work when it is run on the iphone?

//print out the file path
NSLog(@"FilePath: ");
NSLog(filePath);


//Cast filePath from NSString, to Char array pointer. Needed to get reference to audio file.
const char *path = [filePath cStringUsingEncoding:[NSString defaultCStringEncoding]];

//get a ref to the audio file, need one to open it
CFURLRef audioFileURL   = CFURLCreateFromFileSystemRepresentation (NULL, (const UInt8 *) path, strlen (path), false);

//open the audio file
OSStatus result = AudioFileOpenURL (audioFileURL, 0x03, kAudioFileWAVEType, &mAudioFile);

//were there any errors reading? if so deal with them first
if (result != noErr) {
    NSLog([NSString stringWithFormat:@"Could not open file: %s", filePath]);
    packetCount = -1;
}

I know the path contained within the file is correct. The path on the simulator is

/Users/sam2/Library/Application Support/iPhone Simulator/4.2/Applications/A355770A-6942-4E1F-BB8D-8A1B1906B42C/audioRecorder.app/4sSweepReverse.wav

And the path on the iPhone is

/var/mobile/Applications/2273E045-0A63-439E-A6AC-FD85CD30F7F2/audioRecorder.app/4sSweepReverse.wav

But when debugging the application running on the iPhone i get a -43 error (or File not found) ?

If anyone can help that would be awesome!
Sam

  • 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-20T11:49:26+00:00Added an answer on May 20, 2026 at 11:49 am

    Wow, i feel like a bit of an idiot now! Thanks for all your suggestions guys, turns out that the iPhone was finding the file, but I was opening it with the permission flags ‘0x03’ which is read/write permissions, and obviously as a resource I can only access it with ‘0x01’ read only permissions.

    Here is the correct line of code:

        //open the audio file
    OSStatus result = AudioFileOpenURL (audioFileURL, 0x01, kAudioFileWAVEType, &mAudioFile);
    

    Once again, thanks for all your help!!

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

Sidebar

Related Questions

I wonder whether someone could help me please. I've been trying to find a
I wonder if anybody could help me please with a tricky problem I am
I wonder whether someone could help me please, From a tutorial I found online
I wonder if you could help me. I have a list of data that
I wonder whether someone can help me please. I'm trying to implement the mysql_insert_id()
I wonder if you can help me with a problem I am having, and
I wonder, if someone could help me... Is there a LINQ query that will
Could you help me find the error in this one: The event triggers before
I wonder if there is any page where I could write a class name,
I wonder if you guys could help me. I have a table called modules

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.