ios - GMSAutoCompleteViewController Crashing - Swift 3 -


i upgraded app swift 3 , has been crashing whenever has tried call autocomplete view controller in google maps. know api key isn't problem because working fine when using before upgraded swift 3 , xcode 8. know because app still able display google map. here code:

extension additionalsetupviewcontroller: gmsautocompleteviewcontrollerdelegate {      func  viewcontroller(_ viewcontroller: gmsautocompleteviewcontroller, didautocompletewith place: gmsplace) {         let locationcoordinate = place.coordinate          if homeclicked {             homeaddress = [locationcoordinate.latitude, locationcoordinate.longitude]         }          else if homeaddress == [] {         }          else {              let coordstring = "\(locationcoordinate.latitude) \(locationcoordinate.longitude)".replacingoccurrences(of: ".", with: ",")  //            let coordstring = "\(locationcoordinate.latitude) \(locationcoordinate.longitude)".stringbyreplacingoccurrencesofstring(".", withstring: ",")              ref = firdatabase.database().reference()              let currentuser: string = (firauth.auth()?.currentuser?.uid)!             let address = ref.child("schoolorworkaddress").child(coordstring)             let childupdates = [currentuser: homeaddress]             address.updatechildvalues(childupdates)              finishbutton.alpha = 1             finishbutton.isenabled = true         }          let schoolorworkcoords = "\(locationcoordinate.latitude) \(locationcoordinate.longitude)".replacingoccurrences(of: ".", with: ",")  //        let schoolorworkcoords = "\(locationcoordinate.latitude) \(locationcoordinate.longitude)".stringbyreplacingoccurrencesofstring(".", withstring: ",")         let userid = (firauth.auth()?.currentuser?.uid)!         _ = ref.child("posts").child(userid).key         let additionalbasicinfo = ["schoolorworkaddress": schoolorworkcoords, "homeaddress": homeaddress] [string : any]         let usersref = ref.child("users/\(userid)")         usersref.updatechildvalues(additionalbasicinfo [nsobject : anyobject])          self.dismiss(animated: true, completion: nil)     }       func viewcontroller(_ viewcontroller: gmsautocompleteviewcontroller, didfailautocompletewitherror error: error) {         print(error)     }      func wascancelled(_ viewcontroller: gmsautocompleteviewcontroller) {         self.dismiss(animated: true, completion: nil)     }      func didrequestautocompletepredictions(_ viewcontroller: gmsautocompleteviewcontroller) {         uiapplication.shared.isnetworkactivityindicatorvisible = true     }      func didupdateautocompletepredictions(_ viewcontroller: gmsautocompleteviewcontroller) {         uiapplication.shared.isnetworkactivityindicatorvisible = false     }  } 

here error output:

[pars2.additionalsetupviewcontroller addyourschoolorworkaddress:]: unrecognized selector sent instance 0x7fc4c8d7f200 2016-11-12 13:55:31.755 pars2[3065:191093] *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[pars2.additionalsetupviewcontroller addyourschoolorworkaddress:]: unrecognized selector sent instance 0x7fc4c8d7f200' *** first throw call stack: (     0   corefoundation                      0x00000001068f534b __exceptionpreprocess + 171     1   libobjc.a.dylib                     0x000000010635621e objc_exception_throw + 48     2   corefoundation                      0x0000000106964f34 -[nsobject(nsobject) doesnotrecognizeselector:] + 132     3   corefoundation                      0x000000010687ac15 ___forwarding___ + 1013     4   corefoundation                      0x000000010687a798 _cf_forwarding_prep_0 + 120     5   uikit                               0x0000000104b095b8 -[uiapplication sendaction:to:from:forevent:] + 83     6   uikit                               0x0000000104c8eedd -[uicontrol sendaction:to:forevent:] + 67     7   uikit                               0x0000000104c8f1f6 -[uicontrol _sendactionsforevents:withevent:] + 444     8   uikit                               0x0000000104c8e0f2 -[uicontrol touchesended:withevent:] + 668     9   uikit                               0x0000000104b76ce1 -[uiwindow _sendtouchesforevent:] + 2747     10  uikit                               0x0000000104b783cf -[uiwindow sendevent:] + 4011     11  uikit                               0x0000000104b2563f -[uiapplication sendevent:] + 371     12  uikit                               0x000000010531771d __dispatchpreprocessedeventfromeventqueue + 3248     13  uikit                               0x00000001053103c7 __handleeventqueue + 4879     14  corefoundation                      0x000000010689a311 __cfrunloop_is_calling_out_to_a_source0_perform_function__ + 17     15  corefoundation                      0x000000010687f59c __cfrunloopdosources0 + 556     16  corefoundation                      0x000000010687ea86 __cfrunlooprun + 918     17  corefoundation                      0x000000010687e494 cfrunlooprunspecific + 420     18  graphicsservices                    0x0000000108f02a6f gseventrunmodal + 161     19  uikit                               0x0000000104b07964 uiapplicationmain + 159     20  pars2                               0x00000001010a078f main + 111     21  libdyld.dylib                       0x00000001078d468d start + 1 ) libc++abi.dylib: terminating uncaught exception of type nsexception (lldb)  

i don't if might here code rest of view controller well:

class additionalsetupviewcontroller: uiviewcontroller, uiimagepickercontrollerdelegate, uinavigationcontrollerdelegate {       override func viewdidload() {         finishbutton.alpha = 0.4         finishbutton.isenabled = false          navigationcontroller?.navigationbar.bartintcolor = uicolor(red: 46, green: 204, blue: 113, alpha: 0)     }       @iboutlet weak var mapview : gmsmapview!     var homeclicked = false     var homeaddress: [double] = []      @ibaction func addyourhomeaddress(sender: anyobject) {         homeclicked = true         creategmsviewcontroller()     }      @ibaction func addyourschoolorworkaddress(sender: anyobject) {         homeclicked = false         creategmsviewcontroller()     }      func creategmsviewcontroller() {         let searchautocompletecontroller = gmsautocompleteviewcontroller()         searchautocompletecontroller.delegate = self         self.present(searchautocompletecontroller, animated: true, completion: nil)     }      @iboutlet weak var finishbutton: uibutton!      @ibaction func finishbutton(sender: anyobject) {          let storyboard : uistoryboard = uistoryboard(name: "main", bundle:nil)          let nextviewcontroller = storyboard.instantiateviewcontroller(withidentifier: "tableview") as! uitabbarcontroller         self.present(nextviewcontroller, animated:true, completion:nil)      }   } 

i have no clue why crashing when calls appreciated!

okay turns out, gms autocomplete view controller working fine instead outlet problem. solution deleting current xcode 7 or previous version outlet have , creating new 1 outlets different in xcode 8.


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -