解决方案 »

  1.   

    给你推荐一个扩展可以实现你要的功能。
    LinqToObjectiveC去重复的使用
    NSArray* names = @[@"bill", @"bob", @"bob", @"brian", @"bob"];
    NSArray* distinctNames = [names linq_distinct];  // returns bill, bob and brian
    ////如果是distinct一个dictionary中元素,可以如下这样
    NSArray* peopleWithUniqueAges = [input linq_distinct:^id(id person) {
        return [person age];
    }];
      

  2.   

    再一个就是你的json格式不合法,无法成功序列化成对象。标准的json格式应该是这样的
    [{"code":"001",name:"test1"},{"code":"002",name:"test2"},{"code":"003",name:"test3"}]