简体   繁体   中英

iOS: selecting option returns null first time, not second time

I have an iOS application where you select an option before you log in. The way it works is that you click on the button that says "Select", then it takes you to a UITableViewController which shows you the options, you select the option, and it takes you back to the previous menu with the text replaced with your selection (and a hidden ID saved, too).

During the update of the information (which takes place in tableView:didSelectRowAtIndexPath:) I call NSLog on the object. The first time I call it, it returns null (BUT for some reason the text still changes!) and the second time I call it, it works! Why doesn't it work the first time????

Thanks

您是否将NSLog行放在上一个视图推回代码之前?

The variable was named incorrectly. I don't know why XCode didn't just tell me this instead of giving me an EXC_BAD_ACCESS, but that's what happened.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM