私はここスウィフトを使い始めるには、アップルのチュートリアルを次されています:https://developer.apple.com/library/ios/referencelibrary/GettingStarted/DevelopiOSAppsSwift/Lesson3.html#//apple_ref/doc/uid/TP40015214-CH22-SW1デリゲートを設定する=自己スレッド1が発生します。EXC_BAD_INSTRUCTION(コード= exc_i386_invopサブコード= 0x0の)
私はほとんど同じことをやってますが、いくつかのためにしていますその理由articleLink.delegate = self
は私に
Thread 1: exc_bad_instruction (code=exc_i386_invop subcode=0x0)
と
fatal error: unexpectedly found nil while unwrapping an Optional value
私は文字通り、この部分のためにステップバイアップルのチュートリアルステップを以下てるので、私はこれが起こっている理由については本当に困惑している...
import UIKit
import Alamofire
class ViewController: UIViewController, UITextFieldDelegate {
// MARK: Properties
@IBOutlet weak var articleLink: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
// Handle the text field's user input through delegate callbacks
articleLink.delegate = self // ERROR OCCURS HERE
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// MARK: UITextFieldDelegate
func textFieldShouldReturn(textField: UITextField) -> Bool {
// Hide keyboard
textField.resignFirstResponder()
return true
}
// MARK: Actions
@IBAction func submitLink(sender: AnyObject) {
}
}
ありがとうございます!私はSwiftにはかなり新しいです。私はこれをどのように修正すべきですか? – user6091470
あなたはそのチュートリアルのステップ8の一部をスキップしたか、接続を破ったコンセントを作成した後に変更を加えたようです。あなたのペン先のビューがまだそのコンセントに接続されているかどうかを確認する必要があります。ここにインターフェイスビルダーでその場所を見つける例があります:https://developer.apple.com/library/ios/recipes/xcode_help- IB_connections/chapters/Connections.html#// apple_ref/doc/uid/TP40014227-CH20-SW1 – Jonah