Sitaram Naidu Sitaram Naidu - 4 months ago 9
Objective-C Question

how to take "MainMenuName" in bellow response in to in to nsmutable array objective c and pass to slide menu

[
{
"MainMenuID": 1,
"MainMenuCommonID": 0,
"SubMenuID": null,
"MainMenuName": "ABOUT MLA",
"SubMenuName": null,
"MainPageName": "ABOUTMLA",
"LogoPath": "Images\\Icons\\about_mla.png",
"MenuPosition": 0
},
{
"MainMenuID": 2,
"MainMenuCommonID": 0,
"SubMenuID": null,
"MainMenuName": "NEWS & UPDATES",
"SubMenuName": null,
"MainPageName": "NEWS UPDATES",
"LogoPath": "Images\\Icons\\news.png",
"MenuPosition": 0
},
{
"MainMenuID": 3,
"MainMenuCommonID": 0,
"SubMenuID": null,
"MainMenuName": "PROJECTS",
"SubMenuName": null,
"MainPageName": "PROJECTS",
"LogoPath": "Images\\Icons\\projects.png",
"MenuPosition": 0
},
{
"MainMenuID": 6,
"MainMenuCommonID": 0,
"SubMenuID": null,
"MainMenuName": "GRIEVANCE",
"SubMenuName": null,
"MainPageName": "GRIEVANCE",
"LogoPath": "Images\\Icons\\greivance_icon.png",
"MenuPosition": 0
},
{
"MainMenuID": 8,
"MainMenuCommonID": 0,
"SubMenuID": null,
"MainMenuName": "CONTACT US",
"SubMenuName": null,
"MainPageName": "Contact ",
"LogoPath": "Images\\Icons\\contact.png",
"MenuPosition": 0
}
]

Answer

Try like this

-(void)callToMainMenuService{
    [[HTTP_Helper sharedInstance] global_WebCall:MAIN_MENU_URL completion:^(NSDictionary *json, NSError *requestError) {
        dispatch_async(dispatch_get_main_queue(), ^{ });
        if (!requestError) {
            NSArray *arr =(NSArray *) json ;
            mainmenuarray = [arr valueForKey:@"MainMenuName"];
            NSLog(@"Result Main.... %@",mainmenuarray);
            [self MainmenuData:json];
            [self callToSubMenuService];
        }
    }];
}
Comments