Ios 函数签名专门化<;Arg[0]=归担保人所有,Arg[1]=归担保人所有>;

Ios 函数签名专门化<;Arg[0]=归担保人所有,Arg[1]=归担保人所有>;,ios,objective-c,swift,Ios,Objective C,Swift,我遇到过很多这样的车祸 App.CACountryDetectionViewController.receivedWhereAmI(App.CACountryDetectionViewController)(ObjectiveC.NSNotification)->()的函数签名专门化 在CACountryDetectionViewController.swift中,第62行 堆栈跟踪: App.caccountrydetectionviewcontroller.receivedWhereAmI

我遇到过很多这样的车祸 App.CACountryDetectionViewController.receivedWhereAmI(App.CACountryDetectionViewController)(ObjectiveC.NSNotification)->()的函数签名专门化 在CACountryDetectionViewController.swift中,第62行

堆栈跟踪:

  • App.caccountrydetectionviewcontroller.receivedWhereAmI(App.caccountrydetectionviewcontroller)(ObjectiveC.NSNotification)->()(caccountrydetectionviewcontroller.swift:62)的函数签名专门化
  • @objc App.CACountryDetectionViewController.receivedWhereAmI(App.CACountryDetectionViewController)(ObjectiveC.NSNotification)->()(CACountryDetectionViewController.swift:0)
  • \uuucf通知中心正在向观察者发出呼叫16
  • \uuu37-[CAManager postNotification:object:][u block\u invoke(CAManager.m:95)
CACountryDetectionViewController.swift

    internal func receivedWhereAmI(notification: NSNotification) {
      if let response = notification.object as? CAWhereAmIResponse {
          whereAmIState = .Finished
          defaultCity = response.cities?.objectForKey(response.country.defaultCity) as? CACity // 62
          setCountry(response.country)
      } else {
          failedToReceiveWhereAmI()
      }
    }
viewDidLoad:
addObserver(“receivedWhereAmI:,名称:caccountrymanager接收whereminotification)

Denit:
NSNotificationCenter.defaultCenter().removeObserver(self)


有人能给我解释一下发生了什么事吗?

我也经常犯这些错误。通常最好检查异常是什么。就你的情况而言,我认为应该是:

"unexpectedly found nil while unwrapping an Optional value"
我认为问题可能在于response.country.defaultCity
可以安全地假设响应不是由于if unwrapping语句而为零。但是response.country可以是nil,也可以是response.country.defaultCity,这样就可以抛出异常

我也经常遇到这些错误。通常最好检查异常是什么。就你的情况而言,我认为应该是:

"unexpectedly found nil while unwrapping an Optional value"
我认为问题可能在于response.country.defaultCity
可以安全地假设响应不是由于if unwrapping语句而为零。但是response.country可以是nil,也可以是response.country.defaultCity,这样就可以抛出异常

你的电话号码是62code@Yarneo
defaultCity=response.cities?.objectForKey(response.country.defaultCity)作为?CACity//62
您的表中62是哪一行code@Yarneo
defaultCity=response.cities?.objectForKey(response.country.defaultCity)作为?CACity//62