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 Build a Self-Destructing Message iPhone App Retrieving and Viewing Data from Parse.com Viewing Images Using UIImageView

Alexander Timms
Alexander Timms
55 Points

SIGABRT ERROR

Please could someone tell me why I'm getting this error.

2015-12-22 17:21:40.454 wuu2[1359:601437] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSURL initWithString:relativeToURL:]: nil string parameter' *** First throw call stack: ( 0 CoreFoundation 0x0000000108692f65 exceptionPreprocess + 165 1 libobjc.A.dylib 0x000000010810cdeb objc_exception_throw + 48 2 CoreFoundation 0x0000000108692e9d +[NSException raise:format:] + 205 3 Foundation 0x0000000107cc390e -[NSURL(NSURL) initWithString:relativeToURL:] + 102 4 wuu2 0x0000000106d1532b -[ImageViewController viewDidLoad] + 235 5 UIKit 0x0000000108d46931 -[UIViewController loadViewIfRequired] + 1344 6 UIKit 0x0000000108d4c923 -[UIViewController __viewWillAppear:] + 120 7 UIKit 0x0000000108d7c18a -[UINavigationController _startCustomTransition:] + 1177 8 UIKit 0x0000000108d8b7c7 -[UINavigationController _startDeferredTransitionIfNeeded:] + 712 9 UIKit 0x0000000108d8c67d -[UINavigationController __viewWillLayoutSubviews] + 57 10 UIKit 0x0000000108f2463d -[UILayoutContainerView layoutSubviews] + 248 11 UIKit 0x0000000108c6c11c -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 710 12 QuartzCore 0x000000010bcce36a -[CALayer layoutSublayers] + 146 13 QuartzCore 0x000000010bcc2bd0 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366 14 QuartzCore 0x000000010bcc2a4e _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24 15 QuartzCore 0x000000010bcb71d5 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 277 16 QuartzCore 0x000000010bce49f0 _ZN2CA11Transaction6commitEv + 508 17 UIKit 0x0000000108be553a _afterCACommitHandler + 174 18 CoreFoundation 0x00000001085be9d7 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 23 19 CoreFoundation 0x00000001085be947 __CFRunLoopDoObservers + 391 20 CoreFoundation 0x00000001085b459b __CFRunLoopRun + 1147 21 CoreFoundation 0x00000001085b3e98 CFRunLoopRunSpecific + 488 22 GraphicsServices 0x000000010ac42ad2 GSEventRunModal + 161 23 UIKit 0x0000000108bbb676 UIApplicationMain + 171 24 wuu2 0x0000000106d1b53f main + 111 25 libdyld.dylib 0x000000010a15292d start + 1 26 ??? 0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)

1 Answer

Hi Alexander,

Without seeing your code, it's difficult to tell you what caused this specifically, but the first part does indicate [NSURL initWithString:relativeToURL:]: nil string parameter', which is probably a good place to start. A nil string parameter here means it's not getting anything for your line which should read:

NSURL *imageFileURL = [[NSURL alloc] initWithString:imageFile.url];
Alexander Timms
Alexander Timms
55 Points

HI, I did as you said and it still didn't work: Here is my code:

  • (void)viewDidLoad { [super viewDidLoad]; PFFile *imageFile = [self.message objectForKey:@"file"]; NSURL *imageFileURL = [[NSURL alloc] initWithString:imageFile.url]; NSData *imageData = [NSData dataWithContentsOfURL:imageFileURL]; self.imageView.image = [UIImage imageWithData:imageData];

    NSString *senderName = [self.message objectForKey:@"senderName"]; NSString *title = [NSString stringWithFormat:@"Sent from %@", senderName]; self.navigationItem.title = title; }

Hi Alexander,

That code looks correct, so the error must be somewhere else. I'd recommend downloading the project file and comparing everything in that code to yours; if you can't find what's causing the error from there, you can always just use that project file instead.

Hope that helps!

Alexander Timms
Alexander Timms
55 Points

Thanks for trying Evan, I have even tried using the project file and that caused more problems. Is there any chance you could send me the project files?

Thanks, Alex

It's also listed under the downloads below the video, but here is the project file.

Alexander Timms
Alexander Timms
55 Points

Yes, but that the project file seemed to create more problems, so is there any chance you can send me yours? Thanks