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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T15:53:16+00:00 2026-05-21T15:53:16+00:00

Hello I’m trying to have it, so once the user shakes the device. I

  • 0

Hello
I’m trying to have it, so once the user shakes the device. I want a sound to play. However once I shake the device it crashes, this is the code which I have used

- (BOOL)canBecomeFirstResponder
{
    return YES;
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];

    [self becomeFirstResponder];
}

- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event
{
    if(motion == UIEventSubtypeMotionShake)
    {
        NSString *path = [[NSBundle mainBundle] pathForResource:@"sound" ofType:@"wav"];
        if (theAudio) [theAudio release];
        NSError *error = nil;
        theAudio = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:&error];
        if (error)
            NSLog(@"%@",[error localizedDescription]);
        theAudio.delegate = self;
        [theAudio play];    
    }
}

And this is the crash report

2011-04-19 19:25:44.337 iApp[314:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSURL initFileURLWithPath:]: nil string parameter'
*** Call stack at first throw:
(
    0   CoreFoundation                      0x00fc3be9 __exceptionPreprocess + 185
    1   libobjc.A.dylib                     0x00db85c2 objc_exception_throw + 47
    2   CoreFoundation                      0x00f7c628 +[NSException raise:format:arguments:] + 136
    3   CoreFoundation                      0x00f7c59a +[NSException raise:format:] + 58
    4   Foundation                          0x00055b12 -[NSURL(NSURL) initFileURLWithPath:] + 90
    5   Foundation                          0x00055aa0 +[NSURL(NSURL) fileURLWithPath:] + 72
    6   iApp                               0x0000305d -[AppViewController motionEnded:withEvent:] + 256
    7   UIKit                               0x002dc07c -[UIWindow sendEvent:] + 350
    8   UIKit                               0x002bf37a -[UIApplication sendEvent:] + 447
    9   UIKit                               0x002c311b _UIApplicationHandleEvent + 1921
    10  GraphicsServices                    0x017daa36 PurpleEventCallback + 1550
    11  CoreFoundation                      0x00fa5064 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
    12  CoreFoundation                      0x00f056f7 __CFRunLoopDoSource1 + 215
    13  CoreFoundation                      0x00f02983 __CFRunLoopRun + 979
    14  CoreFoundation                      0x00f02240 CFRunLoopRunSpecific + 208
    15  CoreFoundation                      0x00f02161 CFRunLoopRunInMode + 97
    16  GraphicsServices                    0x017d9268 GSEventRunModal + 217
    17  GraphicsServices                    0x017d932d GSEventRun + 115
    18  UIKit                               0x002c842e UIApplicationMain + 1160
    19  iApp                               0x0000295c main + 102
    20  iApp                               0x000028ed start + 53
)
terminate called after throwing an instance of 'NSException'
  • 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-21T15:53:16+00:00Added an answer on May 21, 2026 at 3:53 pm

    Given the crash report reason:

    reason: '*** -[NSURL initFileURLWithPath:]: nil string parameter'
    

    along with the last executed line in your app’s code:

       6   iApp               0x0000305d -[AppViewController motionEnded:withEvent:] + 256
    

    I would think that your sound.wav file is missing:

        NSString *path = [[NSBundle mainBundle] pathForResource:@"sound" ofType:@"wav"];
    

    I suggest your make sure:

    1. the sound.wav file is in your project
    2. is case sensitively spelled “sound.wav”

    Hope this helps.

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

Sidebar

Related Questions

hello friends i am trying to get a list of user id and want
Hello I have this problem with PyQt4-dev-tools that include: * a user interface compiler
Hello i have tableview with many objects in it. If i want to add
Hello I have this query... if (isset($_REQUEST['deletePost'])) { $q = $dbc -> prepare(DELETE FROM
Hello Guys I am trying to figure out why i am gettings this error
Hello i have a TextField on my scene. It haves only digits, user input
Hello i have this code var queue = new BlockingCollection<int>(); queue.Add(0); var producers =
Hello fellow developers... just to make sure, I want to ask this question: How
Hello frnds I have windows mobile application, that retrieves location info. Now i want
hello i have a app that connects and post to user wall but when

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.