I know that there are a lot of questions about this error, but I haven't found solution for my problem, even if I read most of them. In view controller I'm trying to make my text view displaying top of text, instead of bottom of it. When there is only one textView, then everything works perfectly, but when I try do it with two of the, , then I get EXC_BAD_INSTRUCTION error.
import UIKit
import Social
class ViewController: UIViewController {
@IBOutlet weak var textViewA: UITextView!
@IBOutlet weak var textViewB: UITextView!
override func viewDidLoad() {
super.viewDidLoad()
}
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
textViewA.setContentOffset(CGPointZero, animated: false)
textViewB.setContentOffset(CGPointZero, animated: false)
}
This code works for me. I tested it on my own. This is mostly an outlet error, if they aren't connected correctly. It could also be that you have removed an outlet from your code and still have it connected inside your storyboard.
来源:https://stackoverflow.com/questions/35102749/exc-bad-instruction-error