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

Table cell sizing and location in diary app

I'm having some difficulty with the diary app. My code for dynamically resizing the height of the table cell doesn't seem to be working. I'm experiencing a lot of collision issues, especially with longer posts. The body and location text go well beyond the table divider/inset. I've scrutinized the heightForEntry method very carefully, but haven't been able to find anything.

Also, location services are not working in the simulator, or on a device. The code looks identical to me. I've also checked that location services are turned on and that the specific app has permission.

Any help would be greatly appreciated! I've been playing with this all day, and could really use a second set of eyes. Thanks!

https://github.com/Noah-T/Diary-With-Core-Data

2 Answers

Hello Noah Teshu, I've had a look a the code, and the location settings just needed two new changes (iOS 8's fault!)

One was in viewDidLoad of NATEntryViewController.m, this one line needed adding [self.locationManager requestWhenInUseAuthorization];

and the other was in the info tab of project settings (go to project navigator, press diary at the top and navigate over to the info tab, in the list 'custom iOS target properties' add a new key called "NSLocationWhenInUseUsageDescription" of type string, and give it the value of "Request permission to use location service when the apps is in background." and run the app, location should be working! Just having a look into the autosizing now, hope this helps, Kieran

It worked! Thank you for taking the time to look over my code.

Initially this didn't work, but at the suggestion of a Stack Overflow post, I tried editing the info.plist file in an external text editor (instead of in Xcode). Again, kind of weird, but once I put the key and value in there, it was fine.

Glad it worked mate! maybe Ben Jakuben, Amit Bijlani, Stone Preston, Ash Furrow can help with the cell resizing problem, I'm stumped!

Thanks for trying!

I know iOS 8 has brought some new possibilities for autosizing cells, but I'd like to understand how to make this method work, too. If any of the teachers could please look over this, I'd appreciate it. Thanks.