Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

help! can anyone help me with this: "libc++abi.dylib: terminating with uncaught exception of type NSException"

i was trying to add song in my crystal ball app. when I run my project in simulator, it throws an exception , the message in log window is as follows:

""2014-08-20 17:12:33.937 CrystalBall[914:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSURL initFileURLWithPath:]: nil string parameter' *** First throw call stack: ( 0 CoreFoundation 0x01c6e1e4 __exceptionPreprocess + 180

1   libobjc.A.dylib                     0x019ed8e5 objc_exception_throw + 44

2   CoreFoundation                      0x01c6dfbb +[NSException raise:format:] + 139

3   Foundation                          0x0160992b -[NSURL(NSURL) initFileURLWithPath:] + 123

4   Foundation                          0x016097fd +[NSURL(NSURL) fileURLWithPath:] + 67

5   CrystalBall                         0x000020b8 -[THViewController viewDidLoad] + 264

6   UIKit                               0x007cc33d -[UIViewController loadViewIfRequired] + 696

7   UIKit                               0x007cc5d9 -[UIViewController view] + 35

8   UIKit                               0x006ec267 -[UIWindow addRootViewControllerViewIfPossible] + 66

9   UIKit                               0x006ec5ef -[UIWindow _setHidden:forced:] + 312

10  UIKit                               0x006ec86b -[UIWindow _orderFrontWithoutMakingKey] + 49

11  UIKit                               0x006f73c8 -[UIWindow makeKeyAndVisible] + 65

12  UIKit                               0x006a7bc0 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 2097

13  UIKit                               0x006ac667 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 824

14  UIKit                               0x006c0f92 -[UIApplication handleEvent:withNewEvent:] + 3517

15  UIKit                               0x006c1555 -[UIApplication sendEvent:] + 85

16  UIKit                               0x006ae250 _UIApplicationHandleEvent + 683

17  GraphicsServices                    0x031aff02 _PurpleEventCallback + 776

18  GraphicsServices                    0x031afa0d PurpleEventCallback + 46

19  CoreFoundation                      0x01be9ca5 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53

20  CoreFoundation                      0x01be99db __CFRunLoopDoSource1 + 523

21  CoreFoundation                      0x01c1468c __CFRunLoopRun + 2156

22  CoreFoundation                      0x01c139d3 CFRunLoopRunSpecific + 467

23  CoreFoundation                      0x01c137eb CFRunLoopRunInMode + 123

24  UIKit                               0x006abd9c -[UIApplication _run] + 840

25  UIKit                               0x006adf9b UIApplicationMain + 1225

26  CrystalBall                         0x000029dd main + 141

27  libdyld.dylib                       0x02998701 start + 1

28  ???                                 0x00000001 0x0 + 1

) libc++abi.dylib: terminating with uncaught exception of type NSException""

2 Answers

Stone Preston
Stone Preston
42,016 Points

is the file named "fast swoosh down" or "Fast swoosh down". double check the name. if its lowercase f try

NSString *filepath=[NSBundle pathForResource:@"fast swoosh down" ofType:@"wav" inDirectory:@"mainbundle"];

you also may want to rename it to a file name with no spaces like fastswooshdown.wav. sometimes spaces in file paths mess things up if you dont escape them properly

Stone Preston
Stone Preston
42,016 Points

the error message states [NSURL initFileURLWithPath:]: nil string parameter so it looks like you passed a string with a value of nil as the path parameter to an NSURL initializer. can you post some code that shows where you are working with an NSURL and file path?

my code is as follows, fast swoosh down.wav is the name of my sound file

NSString *filepath=[NSBundle pathForResource:@"Fast swoosh down" ofType:@"wav" inDirectory:@"mainbundle"];