如何在AFHTTPSessionManager中添加原始体?

时间:2016-05-19 08:39:47

标签: ios objective-c afnetworking-2

我想要像J {Postman body那样请求JSON中的原始主体。请回答这个问题。

2 个答案:

答案 0 :(得分:0)

-(NSMutableArray *)filterMeetingsBasedOnTime:(BOOL)isPastMtng :(NSMutableArray*)arr
{
NSDate *dt = [NSDate date];
 NSDateFormatter *df =[[NSDateFormatter alloc] init];
[df setDateFormat:@"hh:mm"];


NSMutableArray *arrMeeting = [[NSMutableArray alloc] init];

for(NSDictionary *sMtngDict in arr)
{
    NSDate  *meetDate = [df dateFromString:[sMtngDict valueForKey:@"time"]];

if(isPastMtng)
{
    if([meetDate timeIntervalSinceDate:dt]<0)
    {
        [arrMeeting addObject:sMtngDict];
    }
}

}

return arrMeeting;
}

这会有所帮助

答案 1 :(得分:0)

NSMutableArray * pastTimeArray = [NSMutableArray array];

for ( NSDictionary *dict in TimesArray)//TimesArray is your input array
{
    NSDateFormatter *formatter=[[NSDateFormatter alloc]init];
    [formatter setDateFormat:@"HH:mm"];

    NSDate *givenTime=[formatter dateFromString:[dict objectForKey:@"time"]];
    NSString *temptime = [formatter stringFromDate:[NSDate date]];
    NSDate *CurrentTime=[formatter dateFromString:temptime];
    NSComparisonResult result=[CurrentTime compare:givenTime];

    if (result==NSOrderedAscending)
    {
        [pastTimeArray addObject:[formatter stringFromDate:givenTime]];
        NSLog(@"%@",pastTimeArray);
    }
}