ios - using storyboards -


i trying tutorial using story board ray. using tab bar controller connecting tableview embedded navigation controller, , table view named players , view controller connecting tab bar controller named gestures. displaying players game, name , rating in players tableview storing details in object. have created new file player base object store them properties have store properties in array of view controller called player view controller , have make array , test player objects in app delegate , assign playersviewcontroller’s players property using instance variable.so in appdelegate.m, imported player , player view controller.h headers , add new instance variable named _players. code in app delegate.m below error subscript requires size of interface 'nsarray' not constant in non-fragile abi @ line viewcontrollers[0].

#import "appdelegate.h" #import "player view controller.h" #import "player.h"  @implementation appdelegate {    nsmutablearray *_players; }  @synthesize window = _window;  - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions {    _players=[nsmutablearray arraywithcapacity:20];    player *player1=[[player alloc]init];    player1.name=@"name";    player1.game=@"cricket";    player1.rating=3;    [_players addobject:player1];    player1=[[player alloc]init];    player1.name=@"name";    player1.game=@"football";    player1.rating=3.5;    [_players addobject:player1];    player1=[[player alloc]init];    player1.name=@"tony";    player1.game=@"handball";    player1.rating=4;    [_players addobject:player1];    uitabbarcontroller *tabbarcontroller = (uitabbarcontroller *)self.window.rootviewcontroller;    uinavigationcontroller *navigationcontroller = [tabbarcontroller viewcontrollers][0];    uinavigationcontroller *navigationcontroller = [tabbarcontroller viewcontrollers][0]; /*at point error  [error: subscript requires size of interface 'ns array' not constant in non-fragile abi] */    player view controller *playersviewcontroller = [navigationcontroller viewcontrollers][0];      playersviewcontroller.players = _players;     return yes; 

you can use below code

uinavigationcontroller *navigationcontroller =      [tabbarcontroller.viewcontrollers objectatindex:0]; 

refer below links..regarding error , explanation..!

what non-fragile abi?

subscript requires size of interface 'nsarray', not constant in non-stable abi

hope helps you...!


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -