表视图到详细视图问题
我在 iPhone 上的 iOS 视图中遇到了一个奇怪的问题。
我的应用程序有一个表格和一个选项卡栏。我可以很好地向下钻取,直到到达 DetailView,其中提供了一本书的详细信息(名称、作者、ISBN 和图像),
这加载得很好。然而,在同一个 DetailView 上,我有一个启动另一个视图的按钮。该视图显示良好,在此视图上,人们可以联系作者(文本字段和提交按钮)
这是问题开始的地方
1)如果我转到详细视图并按联系按钮三次,即(打开ContactView,关闭视图、打开 ContactView、关闭视图)在第三次按下时应用程序崩溃
2)如果我启动 ContactView 然后关闭它。如果我回到最顶层并再次按同一本书,应用程序就会崩溃,即《
Harry Potter 1》>《Harry Potter 1》。详细视图>按联系按钮>启动联系人视图>取消联系查看>钻回至顶层 >按 Harry Potter 1
应用程序此时崩溃。
然而,如果我再做一次同样的事情:
《哈利·波特 1》>详细视图>按联系按钮>启动联系人视图>取消联系查看>钻回至顶层 >按 Harry Potter 2
应用程序不会崩溃。
数据结构:
我按照以下方式使用 JSON:(http://tempered.mobi/%20) 来构建我的表。
启动详细视图需要发送有关所选书籍的视图数据,即所选行将字典发送到包含所有信息的详细视图。然后将启动详细视图。
我无法获得任何调试信息,但我有两个理论:
1)我没有正确管理内存,我已经检查了三次。
2)在这个过程中,我丢失了有关所选书籍的信息。信息正在发送到DetailedView,但发送后就会丢失。
任何解决问题的想法都非常受欢迎!
I'm having a strange problem with a view in iOS on iPhone.
My App has a table and a tabBar. I can drill down just fine until I get to a DetailView, which gives details of a book (Name, author, ISBN and an Image)
This loads fine. However on that same DetailView I have a button that launches another view. This view displays fine, and on this view one can contact the Author (A text field and a submit button)
Here is where the problem starts
1) If I go to the detailed view and press the Contact Button three times i.e. (Open ContactView, Dimiss View, Open ContactView, Dismiss View) on the third press the App crashes
2) If I launch the ContactView and then dimiss it. If I drill back to the very top level and press the same book again, the App crashes i.e.
Harry Potter 1 > Detail View > Press Contact Button > Launch ContactView > Dimiss Contact View > Drill Back up to Top Level > Press Harry Potter 1
The App crashes at this point.
However if I do the same again:
Harry Potter 1 > Detail View > Press Contact Button > Launch ContactView > Dimiss Contact View > Drill Back up to Top Level > Press Harry Potter 2
The App doesn't crash.
Data Structure:
I used JSON as per this: (http://tempered.mobi/%20) to build my table.
Launching the DetailedView entails sending the view data about the selected book i.e. Selected row sends a Dictionary to the Detailed View containing all the info. The detailed view then launches.
I can't get any debug info but I have two theories:
1) I amn't managing memory right, which I have tripled checked.
2) Somewhere along the line I'm losing information about the selected book. The info is being sent to DetailedView but being lost once sent.
Any troubleshoot ideas gladly welcomed!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
打开调试器窗口进行构建和调试。当应用程序崩溃时,它会显示上次运行的方法。这应该对你有帮助。
我可能建议的另一件事是重写受影响的代码。希望不会太多。我不确定你有多长/有多优秀的开发人员,但我发现当我在学习代码时编写应用程序时,你第一次重写的代码很糟糕,并且导致了后来重写修复的问题。
Do a build and debug with the debugger window open. When the app crashes it will show you what method was last run. This should help you.
Another thing I might suggest is rewriting the affected code. Hopefully it's not to much. I'm not sure how long/good developer you are but I found that when I wrote an app while learning the code u first rewritten was awful and it caused problems later on which rewriting fixed.