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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:46:39+00:00 2026-06-12T15:46:39+00:00

I have an app on the store since one year, and few persons owning

  • 0

I have an app on the store since one year, and few persons owning an iPhone 4S tell me that sounds are not playing on their devices. (they do not hear anything, either with earphones or with internal speaker)

I have still tested on real devices (iPhone 3G, 3GS, 4, ipod 1G, 2G, 3G, 4G, ipad 1,2,3) and all seems correct. Sounds are playing.
(tested on various OS : iOS 3.1.2 –> 6.0, and it works also in simulator)

Unfortunately i have not myself an iphone 4S for testing, so it’s very hard to know what’s wrong with this particular device.

Could it be a problem with iPhone sound settings ?

But maybe it’s a problem regarding my code ?
So, here is the code i use to play sounds.

Is it correct ?

in the .h …:

@private AVAudioPlayer* myPlayer; 

in the .m …:

-(IBAction)playMySound{
playerPlay = YES; // it's a bool variable used at an other place in the code
NSString *path;
if((path = [[NSBundle mainBundle]  
       pathForResource:[NSString stringWithFormat:@"%d", idsound ] 
       ofType:@"m4a" 
       inDirectory:@"sounds"]))
    {
    NSURL *url = [NSURL fileURLWithPath:path];
    NSError *error;
    myPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error];
    if (myPlayer == nil) {[myPlayer release]; return;}
    myPlayer.delegate = self;
    [myPlayer play];
    }
else return; 
}

Any advice would 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-06-12T15:46:40+00:00Added an answer on June 12, 2026 at 3:46 pm

    You code is really weird:

    Here you correctly create the player:

    myPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error];
    

    The you check if it is nil, still correct.

    if (myPlayer == nil) 
    

    But then you call release on a nil object, which wil do nothing since the object is nil:

    {[myPlayer release]; return;}
    

    This should be a bit better:

    NSError *error = nil;
    myPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error];
    if (myPlayer == nil) {
       NSLog(@"Error creating AVAudioPlayer: %@", error); 
       return;
    }
    myPlayer.delegate = self;
    [myPlayer prepareToPlay];
    [myPlayer play];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an iPhone app that I've built for the app store. Before I
I have an app on the app store, that uses coredata as storage. I
I already have an iPhone application (version 1.0) available in the App Store and
I have an app in the app store that uses Core Data to persist
I have two application with the same identifier.One is for mac app store and
I have a Universal iOS app that has been in the App Store for
I have an app that shows store sales. It is a multi-dimensional array, so
I have newer version app to update to app store, but since there were
I have a fairly image-intensive iPhone app, and I'm looking to store remotely downloaded
I currently have an app published on the App Store but I've just updated

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.