开发者

Updating gps locations in a uitable view in the cell.detailTextLabel.text problem

开发者 https://www.devze.com 2023-02-05 20:20 出处:网络
I am working on a Core Location based application which displays the name of the place you are heading towards in the UITableView text and display how far away from the location you are from in the ce

I am working on a Core Location based application which displays the name of the place you are heading towards in the UITableView text and display how far away from the location you are from in the ce开发者_如何学Cll.detailTextLabel.text.

I have GPS delegate that updates the location and I set a Core location getter and setter and try to use that location to set the cell.detailTextLabel.text each time I get an update.

But my problem lies in scrolling the UITableView. When i click on a cell is goes to where I want it to but if I try to scroll the view to see all the cells the app crashes and issues a bad access error. I don't know where there is a bad access in the location update or if there is a better way to get the gps locations into the cell.detailTextLabel.text and update it better than get the new location and reloading the data.

any help would be greatly appreciated.

thanks


Almost certainly you have an error in your UITableViewDataSource or UITableViewDelegate methods. If you don't get the count of sections and cells right or if you don't return a valid cell as required you will always crash. Some NSLogs in these functions might help you to spot any problems as they occur.

Next make sure to set the environment variable (doubleclick the app executable, select arguments) and add "NSZombieEnabled" with value YES. If you are releasing something that your table later uses, EXC_BAD_ACCESS is the result and this will cause a debugger breakpoint rather than just a mysterious crash - with a stack trace you should be able to easily find the problem.

You're using reloadData to refresh the table view cell?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号