如何将数据传递到同一个类中的pplandate?

时间:2019-06-28 07:12:45

标签: swift xcode10.2

如何将数据传递到pplandate中?

我收到错误

  

线程1:致命错误:展开包装时意外发现nil   可选值

class PlanDataViewController: UIViewController, UIPickerViewDataSource, UIPickerViewDelegate, UITextFieldDelegate{

var pshipment: String?
 var pplandate: String?

override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
        getPlanDatetoPickerview(ptruckID: ptruckid!)
        getShipmenttoPickerView(shiptruckID: ptruckid!, shipplandate: shipmentPlandate)
        getPlanDetail(shipment: pshipment, plandate: pplandate). ==>Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value
    }//Main Method
 func getPlanDatetoPickerview(ptruckID: String)-> Void {
….
     self.pplandate = checkPlanDateFullFormat
}

输出 checkPlanDateFullFormat ==> 20190118, pplandate ==> 20190118

func getShipmenttoPickerView(shiptruckID: String, shipplandate: String) -> Void {
….
  self.pshipment = checkShipmentFullFormat
}

输出 checkShipmentFullFormat ==> 4505023529, 数量==> 4505023529

 func  getPlanDetail(shipment: String, plandate: String)-> Void {
…..

    // Driver
    let Driver1: String = jsonDictionaryPlanDetail["Driver1"] as! String
    let Driver2: String = jsonDictionaryPlanDetail["Driver2"] as! String
    let carRegistrtation: String = self.ptruckNo! 
…..
}
}

0 个答案:

没有答案