访问NSDictionary值

时间:2013-03-05 08:20:23

标签: ios6 nsdictionary

我有一个像这样的JSon对象

{

Attendance =     {
    Attendance =         (
                    {
            EmployeeCode = 7593;
            InDate = "27/02/2013";
            InTime = "08:11";
            InTime2 = "00:00";
            OutDate = "27/02/2013";
            OutDate2 = "01/01/1901";
            OutTime = "17:42";
            OutTime2 = "00:00";
            Present = 1;
        }
    );
    AttendanceCount = 1;
};
AuthPersons =     {
    WFAuthCount = 1;
    WfAuthPersons =         (
                    {
            LsAuthls =                 (
                                    {
                    AuthEmployeeName = "SAMPLE NAME";
                    EmployeeCode = 4813;
                }
            );
            RequestTypeCode = 5;
            WFID = 99;
            "WF_LevelID" = 2;
            WorkFlowName = "EHL - Group HR (Kanchana/Asitha)";
        }
    );
};

}

我想要的是获得这些员工代码,IntDate ......分开所以我得到一个单独的NSDictionary NSDictionary *summary = [resultJSON objectForKey:@"Attendance"];

并将其返回到我的Viewcontroller中的Viewcontroller method我已经这样做了。

` nsDicttendanceReqDate = [[ws GetWorkflowInfoAttendanceRequest:[NSString stringWithFormat:@"%d",usr.empCode] : @"5" :usr.stringRequestDate] copy];



 dicDates= [nsDicttendanceReqDate objectForKey:@"Attendance"] ;
//dicDates=[nsDicttendanceReqDatey JSONValue];

NSLog(@"%d",[dicDates count]);

NSLog(@"DIC DATES%@",dicDates);

NSLog(@"%@",nsDicttendanceReqDate);


 if ([nsDicttendanceReqDate count] > 0 ) {

    NSLog(@"TESTING---------- %@",[dicDates valueForKey:@"EmployeeCode"]);

    NSLog(@"TESTING---------- %@",[dicDates valueForKey:@"OutDate"] );

    NSLog(@"TESTING---------- %@",[dicDates valueForKey:@"InDate"] );`

但这些正在进入禁忌期。我怎么能解决这个问题。任何人都可以告诉我如何提取这个值。

1 个答案:

答案 0 :(得分:0)

试试这个。这可能是一个帮助。

NSDictionary * summary = [resultJSON valueForKey:@“Attendance”] objectAtIndex:0];