"" "스레드 1 : 예외 : 0x7fb12cc088c0" "" "예외 오류로 전송 된 인식 할 수없는 선택기

황 팀

Udacity로 Xcode를 배우고 있습니다. 예외 오류로 인해 문제가 발생했습니다. 여기 내 ViewController.swift 문서가 있습니다.

import UIKit

class ViewController: UIViewController {

    @IBOutlet weak var recordingLabel: UILabel!
    @IBOutlet weak var recordButton: UIButton!
    @IBOutlet weak var stopRecordingButton: UIButton!
    
    func buttonAction(sender:UIButton){
        
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        stopRecordingButton.isEnabled = false
        
        // Do any additional setup after loading the view.
    }
    
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        print("viewWillAppear called")
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // depose of any resources that can be recreated
    }
    
    @IBAction func recordAudio(_ sender: AnyObject){
            recordingLabel.text = "Recording in Progress"
            stopRecordingButton.isEnabled = true
            recordButton.isEnabled = false
    }
    
    @IBAction func stopRecording(_ sender: AnyObject) {
        recordButton.isEnabled = true
        stopRecordingButton.isEnabled = false
        recordingLabel.text = "Tap to record"
    }

}

그리고 여기 내 AppDelegate.swift가 있습니다.

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {



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

    // MARK: UISceneSession Lifecycle

    func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
        // Called when a new scene session is being created.
        // Use this method to select a configuration to create the new scene with.
        return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
    }

    func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
        // Called when the user discards a scene session.
        // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
        // Use this method to release any resources that were specific to the discarded scenes, as they will not return.
    }


}

내 오류 메시지는 다음과 같습니다. Thread 1 : Exception : "-[SingingScope_Storyboard.ViewController recordButton :] : unrecognized selector sent to instance 0x7fb12cc088c0"

이것을 디버그하려면 어떻게해야합니까? 감사합니다!

마일

스토리 보드를 통해 선택기 (이벤트에 연결된 함수)를 추가 한 다음 코드에서 변경하여 스토리 보드가 동기화되지 않는 경우 이러한 문제가 발생할 수 있습니다.

에 연결 buttonAction(sender:UIButton)시도한다고 가정 recordButton하고 다음을 시도하십시오.

  1. 함수를 @IBAction으로 표시하십시오. (스토리 보드에 연결 한 후 실수로 삭제 하셨나요?)@IBAction func buttonAction(sender: UIButton)
  2. 스토리 보드로 이동하여 버튼을 선택한 후 연결 검사기로 이동하여 기존 연결을 삭제하고 모든 연결을 삭제합니다 (스크린 샷에서 View Controller / Your Function 옆에있는 x를 클릭합니다).

Xcode 연결 검사기

  1. 연결하려는 이벤트 옆에있는 원을 드래그하여 뷰 컨트롤러 위에 놓은 다음 buttonAction 함수를 선택하여 함수를 버튼에 다시 연결합니다.

그래도 문제가 해결되지 않으면 스토리 보드 연결의 스크린 샷을 제공해 주시면 더 많은 도움을 드리겠습니다!

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

Related 관련 기사

뜨겁다태그

보관