2016-10-17 9 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

어디에서이 뷰 컨트롤러를 인스턴스화합니까? 그 코드를 보여주세요. –

+0

나는 그 방법의 것들에 많은 오류를 가져 왔습니다. 기존 코드의 맨 아래에 코드를 추가했습니다. –

답변

0

공지 방법 서명에 바로 여기 콜론 :

-[Field_Service_Report.AddController hoursStepper:] 
               ^

이 매개 변수가 아닌 접근의 서명을 취하는 방법의 서명입니다. 선택기 이름을 어딘가에서 잘못 입력하지 않았거나 실수로 IB에서 연결된 무언가를 제거해야합니까? (아마도 당신이 메서드의 이름을 바꾸고 액션 연결을 다시하지 않았다면)

+0

제안 해 주셔서 감사합니다.하지만 모든 것을 시도했지만 아직 해결할 수 없습니다. 이제 setValue를 말하면서 오류가 발생합니다. 내 앱 아이콘에서 경고가 2 개뿐이며 앱을 재생하고 버튼을 클릭하면 다음 VC로 이동하여 오류가 발생합니다. (SIGABRT) –