2016-10-17 4 views
0

私はUIStepperとDatePickerのような多くの異なるボタンとMapViewを持っています。誰も私の全体のビューコントローラとボタンが動作するのを助けることができます。私はSIGABRTについて間違いを受けています。これは、の "キャッチされない例外により 'NSInvalidArgumentException'、理由にアプリを終了: ' - [Field_Service_Report.AddController hoursStepperは:]:認識されていないセレクタはインスタンス0x7fb5d7c8d010に送信された'" と言う新しいViewControllerがSIGABRTエラーを出していますか?

これは私のビューコントローラのコードです:

import UIKit 
import MapKit 
import CoreLocation 

class AddController: UIViewController, MKMapViewDelegate, CLLocationManagerDelegate { 

@IBOutlet weak var hoursStepperResult: UILabel! 

@IBOutlet weak var hoursStepper: UIStepper! 

@IBOutlet weak var minutesStepperResult: UILabel! 

@IBOutlet weak var minutesStepper: UIStepper! 

@IBOutlet weak var currentLocationLabel: UILabel! 

@IBOutlet weak var dateOfReport: UIDatePicker! 

@IBOutlet weak var mapView: MKMapView! 

let locationManager = CLLocationManager() 

override func viewDidLoad() { 
    super.viewDidLoad() 

    // Start Map Contents 
    self.locationManager.delegate = self 
    self.locationManager.desiredAccuracy = kCLLocationAccuracyBest 
    self.locationManager.requestWhenInUseAuthorization() 
    self.locationManager.startUpdatingLocation() 
    self.mapView.showsUserLocation = true 
    // End Map Contents 

} 

// Start Stepper Contents 

@IBAction func hoursStepperAction(_ sender: UIStepper) { 
    hoursStepperResult.text = String(Int(sender.value)) 
} 

@IBAction func minutesStepperAction(_ sender: UIStepper) { 
    minutesStepperResult.text = String(Int(sender.value)) 
} 


// End Stepper Contents 

override func didReceiveMemoryWarning() { 
    super.didReceiveMemoryWarning() 
    // Dispose of any resources that can be recreated. 
} 
// Here is the new code its giving me 3 erroe because im trying to get the text and numbers from another ViewController to print out in this VC. 

@IBAction func doneACButton(_ sender: AnyObject) { 
    let newVC = storyboard?.instantiateViewController(withIdentifier: "ResultController") as! ResultController 
    newVC.intPassed = hoursIntProvided 
    newVC.intPassed = minutesIntProvided 
    newVC.stringPassed = resultedHours.text! 

} 


func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { 

    let location = locations.last 
    let center = CLLocationCoordinate2D(latitude: location!.coordinate.latitude, longitude: location!.coordinate.longitude) 
    let region = MKCoordinateRegion(center: center, span: MKCoordinateSpan(latitudeDelta: 1, longitudeDelta: 1)) 
    self.mapView.setRegion(region, animated: true) 
    self.locationManager.stopUpdatingLocation() 
} 

func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) { 
    print("Errors: " + error.localizedDescription) 
} 



// MARK: - Navigation 


} 
+0

ここから、このView Controllerをインスタンス化しますか?そのコードを表示してください –

+0

私はメソッドのものに多くのエラーを取得してきました。私は既存のコードの一番下にコードを追加しました。 –

答えて

0

お知らせ右ここにメソッドシグネチャのコロン:

-[Field_Service_Report.AddController hoursStepper:] 
               ^

このパラメータではなく、アクセサの署名を受け取るメソッドの署名です。セレクタの名前を間違って入力したり、間違ってIBに接続されていたものを削除しないでください。 (おそらく、メソッドの名前を変更してアクション接続をやり直すのを忘れた場合)

+0

提案をお寄せいただきありがとうございますが、私はすべてを試しましたが、まだ解決できませんでした。setValueというエラーが表示されています。私のアプリアイコンから警告が2つしかありません。ボタンを押して次のVCに移動すると、クラッシュし、そのエラーが表示されます。(SIGABRT) –

関連する問題