私はctrl +ドラッグしても参照しています....しかし、私はNSExceptionでクラッシュするアプリを実行するとき...私はそれをチェックすると私のビューコントローラは、 gifビューとアクションcheck_internetもビューコントローラで定義されていません。以下は私のビューコントローラのコードです。私のアウトレットは参照されていません
import UIKit
extension UIViewController{
func checkreachability()
{
if currentReachabilityStatus == .notReachable
{
let alert = UIAlertController(title: "No Internet ", message: "Please Check Your Internet Connection", preferredStyle: UIAlertControllerStyle.alert)
// add an action (button)
alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: nil))
// show the alert
self.present(alert, animated: true, completion: nil)
}
}
のViewController:
class ViewController: UIViewController {
@IBOutlet weak var gifview: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
gifview.loadGif(name: "source")
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func check_internet(_ sender: UIButton) {
checkreachability()
}
}
古いコンセントをチェックして古いアウトレットを削除してください。 –
@nithinsampath 'viewController'クラスはstoryBoardのclassフィールドに指定されていますか?また、 'ViewController'という名前の複数のクラスがないことを確認してください – Bali
ごめんなさい...私はnoobですので... @DSDharmaを詳しく教えてください – nithinsampath