debugging - iOS Root Controller At Launch Error -


i'm recieving following error code when trying test run app.

application windows expected have root view controller @ end of application launch 

the app running fine bare shell app (e.g. no functionality implemented) once added functions viewcontroller.m started generating error.

viewcontroller.m contains.

// //  batttimeviewcontroller.m //  batttime // //  created james krawczyk on 09/03/2012. //  copyright (c) 2012 james krawczyk. rights reserved. //  #import "batttimeviewcontroller.h"  @interface batttimeviewcontroller ()  @end  @implementation batttimeviewcontroller @synthesize resdisplay;  - (void)viewdidload {     [super viewdidload];     // additional setup after loading view, typically nib. }  - (void)viewdidunload {     [self setresdisplay:nil];     [super viewdidunload];     // release retained subviews of main view. }  - (void)batterystatus {     // current date time      datetrack = [nsdate date];      // instantiate nsdateformatter      nsdateformatter *dateformatter = [[nsdateformatter alloc] init];      // set dateformatter format      //[dateformatter setdateformat:@"yyyy-mm-dd hh:mm:ss"];      // or format show day of week sat,11-12-2011 23:27:09      [dateformatter setdateformat:@"hh:mm:ss"];      // date time in nsstring      nsstring *dateinstringformated = [dateformatter stringfromdate:datetrack];      nslog(@"%@", dateinstringformated);      // release dateformatter      //[dateformatter release];        nsarray *batterystatus = [nsarray arraywithobjects:                                @"battery status unknown.",                                @"battery in use.",                                @"battery charging.",                                @"battery charged.", nil];      if ([[uidevice currentdevice] batterystate] == uidevicebatterystateunknown)     {         [resdisplay settext:[batterystatus objectatindex:0]];           nslog(@"%@", [batterystatus objectatindex:0]);     }     else     {            nsstring *msg = [nsstring stringwithformat:                          @"battery charge level: %0.2f%%\n%@", [[uidevice currentdevice] batterylevel] * 100, dateinstringformated ];         [resdisplay settext:msg];           nslog(@"%@", msg);     } }  - (void)loadview  {      // enable monitoring of battery status     [[uidevice currentdevice] setbatterymonitoringenabled:yes];      // print current status     [self batterystatus];      // request notified when battery charge or state changes     [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(batterystatus) name:uidevicebatteryleveldidchangenotification object:nil];     [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(batterystatus) name:uidevicebatterystatedidchangenotification object:nil];  }  - (void)dealloc  {     [[nsnotificationcenter defaultcenter] removeobserver:self];  } @end 

viewcontroller.h is;

// //  batttimeviewcontroller.h //  batttime // //  created james krawczyk on 09/03/2012. //  copyright (c) 2012 james krawczyk. rights reserved. //  #import <uikit/uikit.h>  @interface batttimeviewcontroller : uiviewcontroller {         nsdate  *datetrack; }  @property (weak, nonatomic) iboutlet uilabel *resdisplay;     @end 

i've checked other questions , checked main.m far know looks fine on there. said running fine until added functions.

lastly main.m

// //  main.m //  batttime // //  created james krawczyk on 09/03/2012. //  copyright (c) 2012 james krawczyk. rights reserved. //  #import <uikit/uikit.h>  #import "batttimeappdelegate.h"  int main(int argc, char *argv[]) {     @autoreleasepool {         return uiapplicationmain(argc, argv, nil, nsstringfromclass([batttimeappdelegate class]));     } } 

i don't know if batttimeappdelegate using nib, storyboard or (masochistic) code create window, error means uiwindow instance not have rootviewcontroller. if using nib or sb, need link window's rootviewcontroller batttimeviewcontroller. if using code (please don't), need "window.rootviewcontroller = ahandmadebatttimeviewcontroller;"


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -