zoukankan      html  css  js  c++  java
  • valueforkey objectforkey区别,

    @implementation ResponseState

     

    + (ResponseState*)responseWithDic:(NSDictionary *)dic

    {

        ResponseState* response = [[ResponseStatealloc] init];

        response.status = [[dic valueForKeyNullReplace:@"status"] intValue];

        response.message = [dic valueForKeyNullReplace:@"message"];

        response.remainTime = [[dic valueForKeyNullReplace:@"remainTime"] intValue];

        id number = [dic valueForKeyNullReplace:@"hasmore"];

        if (![number isKindOfClass:[NSNull class]]) {

            response.hasMore = [[dic valueForKeyNullReplace:@"hasmore"] boolValue];

        }

        return response;

    }

     

    @end

     

     

    @implementation ResponseState

     

    + (ResponseState*)responseStateWithJson:(NSDictionary*)json

    {

        ResponseState* state = [[ResponseStatealloc] init];

        state.flag = [[json objectForKey:@"flag"] intValue];

        state.message = [json objectForKey:@"msg"];

        state.total = [[json objectForKey:@"total"] intValue];

        state.current = [[json objectForKey:@"this"] intValue];

        return state;

    }

     

    @end

  • 相关阅读:
    Xshell相关优化
    Inotify+rsync远程实时同步
    MySQL主从复制故障解决
    Docker部署centos7容器
    Salt-ssh批量部署minion
    MySQL数据库二
    防火墙2
    MySQl数据库
    防火墙
    http原理2
  • 原文地址:https://www.cnblogs.com/guligei/p/3332881.html
Copyright © 2011-2022 走看看