2017-07-15 21 views
0

上のインスタンスに送信され、私は、IOSは同社のウェブサイトと私のチュートリアルを始める以下のい記載どおりにすべてを行いましたが、私は奇妙な例外があります。どうしてか分かりません。私はIOS環境と迅速(これは私の最初のMacを使用していると私は2日前にそれを持っている)に新しいです。認識されていないセレクタがこんにちは</p> <p>(私はこの質問を何度も頼まれていたが、彼らは私の問題を解決しなかったことを知っている)のiOSチュートリアル

import UIKit 

class ViewController: UIViewController { 

    // MARK: Properties 
    @IBOutlet weak var mealNameLabel: UILabel! 
    @IBOutlet weak var mealNameTextField: UITextField! 

    override func viewDidLoad() { 
     super.viewDidLoad() 
     // Do any additional setup after loading the view, typically from a nib. 
    } 

    // MARK: Actions 
    @IBAction func setDefaultMealNameLabel(_ sender: AnyObject) { 
     mealNameLabel.text = "Default Meal Name" 
    } 

} 

それは 『食事の名前をデフォルト設定』するmealNameLabelのテキストを変更する必要があります。

は、ここに私のコードです。どのように私はタイトルで奇妙な例外を取得します。私はセレクターが何であるかもわかりません、私はちょうど始めています。

EDIT: setDefaultMealNameLabelという名前のパラメータ型は、以前のUIButtonでした。それはどちらもうまくいきませんでした。

EDIT:エラーが発生した :

import UIKit 

@UIApplicationMain 
class AppDelegate: UIResponder, UIApplicationDelegate { // DEBUGGER SHOWS THAT, IN THIS PLACE, ERROR OCURED. 

    var window: UIWindow? 


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 
    // Override point for customization after application launch. 
    return true 
} 

func applicationWillResignActive(_ application: UIApplication) { 
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 
    // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 
} 

func applicationDidEnterBackground(_ application: UIApplication) { 
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 
} 

func applicationWillEnterForeground(_ application: UIApplication) { 
    // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 
} 

func applicationDidBecomeActive(_ application: UIApplication) { 
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 
} 

func applicationWillTerminate(_ application: UIApplication) { 
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 
} 

}

+0

コードのどの行にエラーがありますか? –

+0

ストーリーボードのibactionを確認してください。何らかの不正な接続が存在する場合は削除します。 – KKRocks

+0

@ MoeAbdul-Hameed編集をご覧ください。 – Bora

答えて

0

はどんな悪いIBActionIBOutlet場合は、ストーリーボードでチェックしてみてください、その存在を取り除きます。

あなたのお役に立てば幸いです。

1

あなたがストーリーボードから接続した後に、IBAction の名前を変更したことはありますか?その場合、ボタンをタップすると、もう存在しないメソッドを呼び出そうとしています。

この場合、接続されているアクションを削除して、ストーリーボードの送信済みイベントで更新する必要があります。

Example

Selectors in Swift

+0

これは、ラベルとテキストフィールドについて私に例外を与えた前のケースでした。しかし、ボタンのために、私はアクションタブを見て忘れて、私はアウトレットを見ていた。とにかく答えてくれてありがとう。 – Bora

関連する問題

 関連する問題