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
Arsene Lavaux
4,342 PointsCrash after tap on image in THDetailViewController
Working on the extra credit of the Photo Bombers instagram app. Build successful but when I tap on an image in THDetailViewController, the screen freezes and I get this message in my log:
https://www.dropbox.com/s/bsaxukip0l96qd1/NSPlaceholderString%20initWithFormat%20_%20nil.png
Not so sure what to do.
Thanks!
7 Answers
Sam Chaudry
25,519 PointsNot clear what you are trying to do you add frameworks from the build settings things like CoreLocation etc and then import them into your code using #import. Or if your importing variables from a different header file for it property's then you use #import.
If you are really trying to get to the root or the problem you could load Xcode up as normal with your code. Then go into folder where Amit's code is and navigate to the .m file you want and then open it. From there you can compare Amit's work to your own and find any errors with your work and it shouldn't seem to over bearing.
Sam Chaudry
25,519 PointsThe NSException error usually creeps up on you when you have a object floating around which isn't referenced properly or it has invalid argument or method passed to it. From your link about your problem, is the app is trying to call an argument that doesn't exist. You've more that likely got an object such as this
[NSObject aMethod [oneObject] anotherMethod: argument ];
What your debugger is telling you is that the argument doesn't exist and this is causing the app to break as it can't find what you are trying to pass in.
Go into your stack trace and see at where in which thread your app breaks (usually on the left). That will tell you at what point of execution your app has broken, go into that and trace the problem in the debugger. Then pop on your break points in your code and step through the app line by line and you can trace where you have the problem.
Just from the console I would make a educated guess and say that there is an object which takes an NSString parameter that you haven't referenced properly, i.e. it could need a string in there to say nil, for whatever reason. Without seeing your code I can't really go much further but I hope this gives you a starting point to debug your app and find the problem.
Arsene Lavaux
4,342 PointsHi Sam,
Thank you for sharing great insight with me on this. I am a beginner and not very familiar with debugging tools. I am here to learn though. :)
Here is where there seems to be a problem in main.m: https://www.dropbox.com/s/dw9zamxjnt5h7k4/Thread1.png
Does that help? Happy to share code if there is an easy way to do that.
Sam Chaudry
25,519 PointsYeah go into your app in your methods file for your view controller, some where in that methods file there is NSString argument that is missing from an object (I'm guessing based on you've uploaded).
Line1 // NSDate *date = [NSDate alloc] init]; Line2// [date setDateFormat:@"dd mm yyyy"];
Looking at the dummy code above this method takes a string argument i.e. @"dd mm yyyy", but if I do this instead
Line1 // NSDate *date = [NSDate alloc] init]; Line2// [date setDateFormat: xxx];
and run the app it will crash giving me a NSInvalidException error saying that xxx or setDateFormat has an invalid argument passed to it.
It's a case of going through it line by line till you find it, pins staking I know but the more you do it the more you will be able to track and trace any problems you are having with your code.
I'm thinking you haven't deleted a place holder from a Object and in that is either a missing argument or you may have entered nil by mistake. Your code is is going to need closer inspection...
Arsene Lavaux
4,342 PointsI am stuck. Not so sure how to proceed here, I have checked line by line with what Amit had shared for the extra credit (Photo Bombers extra credit) and I cannot find anything different.
Is there a tool other than microsoft word that allows to check two code files to ensure they are the same?
Again, I am a beginner and would value expert knowledge from the community on this to improve every day.
Thanks!
Arsene Lavaux
4,342 PointsStill stuck after comparing the two codes with a software. Does the way you import the framework folder matters?
I have imported the new frameworks that I have noticed in Amit's project by dragging/dropping instead of adding them from my project. Could that make any difference?
Any help from the community would be welcome.
Thanks/Merci/Grazie/Gracias :)
Arsene Lavaux
4,342 PointsI cannot find any differences in the code, nor on the framework files associated with the project.
There has to be differences though, I just don't see them.
Is there some sort of code inspector service out there?
Again, I am a beginner and would value wise recommendations to keep exploring iOS coding.
Merci!
Happy to share my code with anyone willing to have a look.