iOS 9 Segue导致应用程序冻结(没有崩溃或错误抛出)
我已经在这个应用程序上工作了好几个月,从我记忆中来看,我从来没有遇到过segue的问题。代码在调用 performSegueWithIdentifier
方面没有变化,但自从我最近更新到Xcode 7和iOS 9后,我无法解决这个问题。
I have been working on this app for months now and from as far back as I can remember I have never had an issue with segues. The code is unchanged in terms of calling performSegueWithIdentifier
but since my recent update to Xcode 7 and iOS 9 I have not been able to tack this issue.
我试过:
- 删除按钮并创建新按钮w / segue链接
- 使用直接按钮来查看,不使用
performSegueWithIdentifier
- 将按钮连接到新的空白viewController
当我按下按钮时,目标VC上没有调用初始加载功能(例如: ViewDidLoad
, ViewWillAppear
等)。当我将它连接到空白视图时,segue可以正常使用相同的代码。
When I press the button, no initial load functions are called on the destination VC (Ex: ViewDidLoad
, ViewWillAppear
, etc). When I connect it to a blank view, the segue works fine with the same code in place.
由于代码永远不会停止或中断,并且只是在Xcode上运行时似乎冻结,我似乎无法将其缩小到最低限度造成这个问题。我有一个类似的segue也可以从同一个ViewController上的另一个按钮调用,它没有任何问题。
Since the code never stops, or breaks, and just seems to "freeze" in place while still running on Xcode I can't seem to even narrow this down to whats causing the issue. I have a similar segue that is also called from another button on the same ViewController that has no issues whatsoever.
对此事的任何想法都非常感谢!
Any thoughts on the matter are greatly appreciated!
编辑:我有将问题缩小到导致问题的 UITextView
。一旦删除了文本视图,页面就会通过segue加载。我想知道iOS 8和iOS 9在 UITextView
方面有什么变化,因为我必须删除文本视图并完全重新添加新的文本视图。
I have narrowed the issue down to the UITextView
's causing the problem. Once the Text Views were removed the page loads fine via segue. I wonder what changed between iOS 8 and iOS 9 in terms of UITextView
as I will have to remove the text views and completely re add new text views.
所以基本上segue因为我在 UITextView
中使用而冻结了code> destinationViewController 。以下修复了此问题:
So basically the segue was freezing because of the UITextView
's I was using in the destinationViewController
. The following fixed the issue:
- 删除所有
UITextView
的 - 添加新的UITextView的
- 你必须保留默认的lorem强制文本并在
viewDidLoad中以编程方式更改( )
- Delete all
UITextView
's - Add new UITextView's
- you must leave the default lorem imposed text and change this programmatically in the
viewDidLoad()
这是我的修复,从我在这个问题上所做的研究来看,这似乎是iOS 9和Xcode 7中的一个错误。
This was the fix for me, and from the research I have done on the issue it seems this is a bug in iOS 9 and Xcode 7.
干杯!
注意:删除UITextView中的文本(或使其长度超过12个字符)足以解决它,不需要删除并重新创建它们。 这在Xcode 7.1.1及更高版本中得到修复。
NOTE: Removing the text in the UITextView (or making it longer then ~12 characters) is sufficient to work around it, no need to delete and recreate them. This is fixed in Xcode 7.1.1 and later.
- you must leave the default lorem imposed text and change this programmatically in the
- 你必须保留默认的lorem强制文本并在