ios - unrecognized selector sent to instance XCODE -


i have dynamic table , when try start emulator, can't. exapmple , don't repair it.

 escarabajofeodoc *bug1 = [[escarabajofeodoc alloc] initwithtitle:@"escarabajo patatero" rating:4 thumbimage:[uiimage imagenamed:@"potatobugthumb.png"] fullimage:[uiimage imagenamed:@"potatobug.png"]];     escarabajofeodoc *bug2 = [[escarabajofeodoc alloc] initwithtitle:@"cienpiés" rating:3 thumbimage:[uiimage imagenamed:@"centipedethumb.png"] fullimage:[uiimage imagenamed:@"centipede.png"]];     escarabajofeodoc *bug3 = [[escarabajofeodoc alloc] initwithtitle:@"araña lobo" rating:5 thumbimage:[uiimage imagenamed:@"wolfspiderthumb.png"] fullimage:[uiimage imagenamed:@"wolfspider.png"]];     escarabajofeodoc *bug4 = [[escarabajofeodoc alloc] initwithtitle:@"mariquita" rating:1 thumbimage:[uiimage imagenamed:@"ladybugthumb.png"] fullimage:[uiimage imagenamed:@"ladybug.png"]];     nsmutablearray *arrbugs = [nsmutablearray arraywithobjects:bug1, bug2, bug3, bug4, nil];      uinavigationcontroller *navcontroller = (uinavigationcontroller *) self.window.rootviewcontroller;     masterviewcontroller *mastercontroller = [navcontroller.viewcontrollers objectatindex:0];     mastercontroller.arrescarabajos = arrbugs; 

the next 1 show error:

 2014-11-19 12:11:45.752 golf tipp[3280:60b] -[masterviewcontroller viewcontrollers]: unrecognized selector sent instance 0x8c24400 2014-11-19 12:11:45.755 golf tipp[3280:60b] *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[masterviewcontroller viewcontrollers]: unrecognized selector sent instance 0x8c24400' *** first throw call stack: (     0   corefoundation                      0x018291e4 __exceptionpreprocess + 180     1   libobjc.a.dylib                     0x015a88e5 objc_exception_throw + 44     2   corefoundation                      0x018c6243 -[nsobject(nsobject) doesnotrecognizeselector:] + 275 ) libc++abi.dylib: terminating uncaught exception of type nsexception 

you have written line  uinavigationcontroller *navcontroller = (uinavigationcontroller *) self.window.rootviewcontroller; expecting window's rootviewcontroller navigation controller returning uiviewcontroller. result when u calling navcontroller.viewcontrollers , application raising exception. because pointer of uinavigationcontroller object inside of uiviewcontroller 

to solve problem

replace below lines of code

uinavigationcontroller *navcontroller = (uinavigationcontroller *) self.window.rootviewcontroller; masterviewcontroller *mastercontroller = [navcontroller.viewcontrollers objectatindex:0]; 

with

masterviewcontroller *mastercontroller = self.window.rootviewcontroller; 

Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -