iphone - '-[UITableViewController loadView] loaded the "MySubscriptionsViewController" nib but didn't get a UITableView.' -
i updated xcode
using 6.1 simulator, app working fine 5.1 simulator,
now getting following error :
terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: '-[uitableviewcontroller loadview] loaded "mysubscriptionsviewcontroller" nib didn't uitableview.'
my header file:
#import <uikit/uikit.h> @interface mysubscriptionsviewcontroller : uitableviewcontroller{ } @property (nonatomic,retain) nsstring *serveraddress; @property (nonatomic, retain) uitextfield *airportfield; @property (nonatomic, retain) nsmutablearray *airportlist; @property (nonatomic, retain) nsmutablearray *colcode; @property (nonatomic, retain) nsmutablearray *colairport; @property (nonatomic, retain) nsmutablearray *colstartdate; @property (nonatomic, retain) nsmutablearray *colstarttime; @property (nonatomic, retain) nsmutablearray *colendtime; @property (nonatomic, retain) nsmutabledictionary *tempairport; @property (nonatomic,strong) nsdictionary *countrylist; @property (nonatomic,strong) nsarray *countrykeys; - (ibaction)meetup:(id)sender; - (ibaction)viewbeacon:(id)sender; -(ibaction)gotohome:(id)sender; -( void)beacon:(nsstring *)thestr; @end
my m file:
#import "mysubscriptionsviewcontroller.h" #import "mybeaconsviewcontroller.h" #import "sbjsonparser.h" #import "gridtableviewcell.h" #import "meetupviewcontroller.h" #import "viewbeaconviewcontroller.h" #import "dataclass.h" #import "memberpanelviewcontroller.h" @interface mysubscriptionsviewcontroller () @end @implementation mysubscriptionsviewcontroller @synthesize countrylist,countrykeys,serveraddress,airportfield,airportlist,tempairport,colstarttime,colendtime,colstartdate,colairport,colcode; - (void)viewwillappear:(bool)animated { [super viewwillappear:animated]; } - (void)viewdidappear:(bool)animated { [super viewdidappear:animated]; } - (void)viewwilldisappear:(bool)animated { [super viewwilldisappear:animated]; } - (void)viewdiddisappear:(bool)animated { [super viewdiddisappear:animated]; } - (void)viewdidload { [super viewdidload]; self.tableview.contentinset = uiedgeinsetsmake(0, 0, 0,0); self.tableview.separatorstyle = uitableviewcellseparatorstylenone; dataclass *obj=[dataclass getinstance]; // serveraddress = @"http://www.cloudnetpk.com/transbeacon_design/services"; nsstring *strurl = [nsstring stringwithformat:@"http://www.cloudnetpk.com/transbeacon_design/services/get_my_beacon_subscriptions.php?code=%@",obj.str]; nslog(@" url => %@",strurl); nsdata *dataurl = [nsdata datawithcontentsofurl:[nsurl urlwithstring:strurl]]; nsstring *strresult = [[nsstring alloc] initwithdata:dataurl encoding:nsutf8stringencoding]; sbjsonparser *parser = [[sbjsonparser alloc] init]; nsarray *datos = [parser objectwithstring:strresult error:nil]; tempairport = [[nsmutabledictionary alloc] init]; airportlist = [[nsmutablearray alloc] init]; colstarttime = [[nsmutablearray alloc] init]; colendtime = [[nsmutablearray alloc] init]; colstartdate= [[nsmutablearray alloc] init]; colairport= [[nsmutablearray alloc] init]; colcode= [[nsmutablearray alloc] init]; countrylist = datos; nslog(@"beacons count %d",datos.count); (int i=0; i<datos.count; i++){ int a=0; nsstring *startdate = [[[datos objectatindex:i] objectforkey:@"start_date" ] lowercasestring]; nsstring *airport= [[[datos objectatindex:i] objectforkey:@"airport" ] lowercasestring]; nsstring *starttime = [[[datos objectatindex:i] objectforkey:@"start_time" ] lowercasestring]; nsstring *endtime = [[[datos objectatindex:i] objectforkey:@"end_time" ] lowercasestring]; nsstring *code = [[[datos objectatindex:i] objectforkey:@"code" ] lowercasestring]; //nslog(@" here =>%@",code); [colstartdate insertobject:startdate atindex:i ]; [colairport insertobject:airport atindex:i ]; [colstarttime insertobject:starttime atindex:i ]; [colendtime insertobject:endtime atindex:i ]; [colcode insertobject:code atindex:i]; //[ tempairport setobject:lcstring forkey:lcstringvalue]; } [super viewdidload]; } - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section{ return [countrylist count]; } /* - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath{ uitableviewcell *cell =[[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:@"cell"]; nsstring *currentcountryname=[countrykeys objectatindex:[indexpath row]]; [[cell textlabel] settext:currentcountryname]; //cell.detailtextlabel.text=@"testing here "; return cell; } */ -(uitableviewcell *) tableview:(uitableview *)tableview viewforheaderinsection:(nsinteger)section { static nsstring *cellidentifier = @"sectionheader"; //uitableviewcell *headerview = [tableview dequeuereusablecellwithidentifier:cellidentifier]; uiview *headerview = [[uiview alloc] initwithframe:cgrectmake(10,0,300,60)] ; uiimage *myimage=[uiimage imagenamed:@"top_bar.png"]; uiimageview *imageview =[[uiimageview alloc] initwithimage:myimage]; imageview.frame= cgrectmake(0, 0, 400, 50); [headerview addsubview:imageview]; uilabel *label = [[uilabel alloc] initwithframe:cgrectmake(110,3, tableview.bounds.size.width - 170,40)]; label.text = @"subscriber list"; label.textcolor = [uicolor colorwithred:0 green:0 blue:0 alpha:1]; label.font = [uifont fontwithname:@"arial-boldmt" size:16]; label.backgroundcolor = [uicolor clearcolor]; [headerview addsubview:label]; uibutton *circularbutton = [uibutton buttonwithtype:uibuttontypecustom]; cgrect circularrect = cgrectmake(5.0, 5, 58.0, 32.0); [circularbutton setframe:circularrect]; [circularbutton addtarget:self action:@selector(meetup:) forcontrolevents:uicontroleventtouchupinside]; uiimage *buttonimage = [uiimage imagenamed:@"back_btn.png"]; [circularbutton setimage:buttonimage forstate:uicontrolstatenormal]; [headerview addsubview:circularbutton]; uibutton *homebutton = [uibutton buttonwithtype:uibuttontypecustom]; cgrect circularrecthome = cgrectmake(250.0, 5, 58.0, 32.0); [homebutton setframe:circularrecthome]; [homebutton addtarget:self action:@selector(gotohome:) forcontrolevents:uicontroleventtouchupinside]; uiimage *buttonimagehome = [uiimage imagenamed:@"home_btn.png"]; [homebutton setimage:buttonimagehome forstate:uicontrolstatenormal]; [headerview addsubview:homebutton]; return headerview; } -(ibaction)gotohome:(id)sender{ // redirect memberpanelviewcontroller *window =[[memberpanelviewcontroller alloc]init]; [self presentmodalviewcontroller:window animated:yes]; } - (cgfloat)tableview:(uitableview *)tableview heightforheaderinsection:(nsinteger)section{ return 50; } - (ibaction)meetup:(id)sender{ nslog(@" button clicked here"); meetupviewcontroller *window =[[meetupviewcontroller alloc]init]; [self presentmodalviewcontroller:window animated:yes]; } - (ibaction)viewbeacon:(id)sender{ viewbeaconviewcontroller *window=[[viewbeaconviewcontroller alloc]init]; [self presentmodalviewcontroller:window animated:yes]; } // customize appearance of table view cells. - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"cell"; gridtableviewcell *cell = (gridtableviewcell*)[tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { cell = [[gridtableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier]; cell.linecolor = [uicolor blackcolor]; } // since drawing lines ourself, need know cell top cell in table // can draw line on top if (indexpath.row == 0) cell.topcell = yes; else cell.topcell = no; // configure cell. //cell.cell1.text = [nsstring stringwithformat:@"%i",indexpath.row]; //cell.cell2.text = [nsstring stringwithformat:@"%i", indexpath.row]; //cell.cell3.text = @"test here text"; cell.cell1.text =[colstartdate objectatindex:indexpath.row]; cell.cell2.text =[colairport objectatindex:indexpath.row]; cell.cell3.text =[colstarttime objectatindex:indexpath.row]; cell.cell4.text = [colendtime objectatindex:indexpath.row]; nsstring *value = [colcode objectatindex:indexpath.row]; nslog(@" value => %@",value); uibutton *circularbutton = [uibutton buttonwithtype:uibuttontypecustom]; cgrect circularrect = cgrectmake(260.0, 2, 60.0, 40.0); [circularbutton setframe:circularrect]; [circularbutton addtarget:self action:@selector(beacon:) forcontrolevents:uicontroleventtouchupinside]; circularbutton.tag=value; uiimage *buttonimage = [uiimage imagenamed:@"view.png"]; [circularbutton setimage:buttonimage forstate:uicontrolstatenormal]; [cell.contentview addsubview:circularbutton]; return cell; } -( void)beacon:(nsstring *)thestr{ nsinteger *tid = ((uicontrol*)thestr).tag; nslog(@" here parameter %@",tid); viewbeaconviewcontroller *window=[[viewbeaconviewcontroller alloc]init]; // window.modaltransitionstyle = uimodaltransitionstylefliphorizontal; window.thedatayouwanttopass =tid; window.lastscreen =@"subscription"; [self presentmodalviewcontroller:window animated:yes]; } - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { /* <#detailviewcontroller#> *detailviewcontroller = [[<#detailviewcontroller#> alloc] initwithnibname:@"<#nib name#>" bundle:nil]; // ... // pass selected object new view controller. [self.navigationcontroller pushviewcontroller:detailviewcontroller animated:yes]; [detailviewcontroller release]; */ } - (id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil { self = [super initwithnibname:nibnameornil bundle:nibbundleornil]; if (self) { // custom initialization } return self; } - (void)viewdidunload { [super viewdidunload]; // release retained subviews of main view. // e.g. self.myoutlet = nil; } - (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation { return (interfaceorientation == uiinterfaceorientationportrait); } @end
terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: '-[uitableviewcontroller loadview] loaded "mysubscriptionsviewcontroller" nib didn't uitableview.' error ocurce becouse bellow issue.
i think problem because subclassing uitableviewcontroller instead of uiviewcontroller. need put uiviewcontroller
subclass , connect iboutlet of uitableview
in xib delegare. tableview
in uiview
of xib connect fileowner uiview
view , uitableview tableview outlate.
@interface mysubscriptionsviewcontroller : uiviewcontroller<uitableviewdelegate, uitableviewdatasource>
or
else there remaining referance of old copy trying restart xcode , remove catch or clean derive data
Comments
Post a Comment