ios - Subclass GMSAutocompleteViewController to use it with Eureka -


i'm trying subclass gmsautocompleteviewcontroller form googleplaces sdk :

class addressfinderviewcontroller: gmsautocompleteviewcontroller, typedrowcontrollertype {  public var row: rowof<string>! public var completioncallback : ((uiviewcontroller) -> ())?    convenience public init(_ callback: (uiviewcontroller) -> ()){     self.init(nibname: nil, bundle: nil)     completioncallback = callback }    override func viewdidload() {     super.viewdidload()        }   } 

then use call :

addressfinderviewcontroller(){ _ in }             }, completioncallback: { vc in                 vc.navigationcontroller?.popviewcontrolleranimated(true)         } 

but error :

2016-09-07 17:21:19.445 priumcity[77058:3790134] *** terminating app   due uncaught exception 'nsinvalidargumentexception', reason: '*** -[__nsarraym insertobject:atindex:]: object cannot nil' *** first throw call stack: (     0   corefoundation                      0x000000010e129d85 __exceptionpreprocess + 165     1   libobjc.a.dylib                     0x000000010ede3deb objc_exception_throw + 48     2   corefoundation                      0x000000010dfeacc5 -[__nsarraym insertobject:atindex:] + 901     3   uikit                               0x000000010c863cec -[uiviewcontroller _addchildviewcontroller:performhierarchycheck:notifywillmove:] + 541     4   uikit                               0x000000010c885087 -[uiviewcontroller(uicontainerviewcontrollerprotectedmethods) addchildviewcontroller:] + 83     5   priumcity                           0x000000010ac0bc9c -[gmsautocompleteviewcontroller viewwillappear:] + 301     6   uikit                               0x000000010c8652bd -[uiviewcontroller _setviewappearstate:isanimating:] + 710     7   uikit                               0x000000010c865958 -[uiviewcontroller __viewwillappear:] + 149     8   uikit                               0x000000010c895750 -[uinavigationcontroller _startcustomtransition:] + 1203     9   uikit                               0x000000010c8a5b9b -[uinavigationcontroller _startdeferredtransitionifneeded:] + 712     10  uikit                               0x000000010c8a6d0b -[uinavigationcontroller __viewwilllayoutsubviews] + 57     11  uikit                               0x000000010ca55503 -[uilayoutcontainerview layoutsubviews] + 248     12  uikit                               0x000000010c77f980 -[uiview(calayerdelegate) layoutsublayersoflayer:] + 703     13  quartzcore                          0x000000010c474c00 -[calayer layoutsublayers] + 146     14  quartzcore                          0x000000010c46908e _zn2ca5layer16layout_if_neededepns_11transactione + 366     15  quartzcore                          0x000000010c468f0c _zn2ca5layer28layout_and_display_if_neededepns_11transactione + 24     16  quartzcore                          0x000000010c45d3c9 _zn2ca7context18commit_transactionepns_11transactione + 277     17  quartzcore                          0x000000010c48b086 _zn2ca11transaction6commitev + 486     18  uikit                               0x000000010c6f119b _aftercacommithandler + 174     19  corefoundation                      0x000000010e04ec37 __cfrunloop_is_calling_out_to_an_observer_callback_function__ + 23     20  corefoundation                      0x000000010e04eba7 __cfrunloopdoobservers + 391     21  corefoundation                      0x000000010e0447fb __cfrunlooprun + 1147     22  corefoundation                      0x000000010e0440f8 cfrunlooprunspecific + 488     23  graphicsservices                    0x00000001139c0ad2 gseventrunmodal + 161     24  uikit                               0x000000010c6c4f09 uiapplicationmain + 171     25  priumcity                           0x000000010aa99482 main + 114     26  libdyld.dylib                       0x000000010f8b292d start + 1     27  ???                                 0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating uncaught exception of type nsexception (lldb)  

you need call super.init() in addressfinderviewcontroller's init function make sure gmsautocompleteviewcontroller initialized properly.


Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -