objective-c - ios model 有一个属性也是model类型,初始化时,进入死循环,怎么破?
仅有的幸福
仅有的幸福 2017-04-26 09:01:54
0
1
647
  • (instancetype)initFromDictionary:(NSDictionary *)dictionary
    {ShowLog
    self = [super init];
    if (self) {

       _cid        =       StringValue(dictionary, KID);
       _user       =       [[User alloc] initFromDictionary:DictionaryValue(dictionary, Kuser)];
       _images     =       ArrayValue(dictionary, Kimages);
       _content    =       StringValue(dictionary, Kcontent);
       
       //_beCommented=       [[Comment alloc] initFromDictionary:DictionaryValue(dictionary, KbeCommented)];
       _createTime =       DateValue(dictionary, KcreateTime);
       _ownerId    =       StringValue(dictionary, KownerId);

    }
    return self;
    }

注释那个行使程序进入了死循环,这个要怎么改?

仅有的幸福
仅有的幸福

reply all(1)
phpcn_u1582

It is also very convenient to initialize and load attributes using the getter method. To call yourself in a method, there needs to be an end condition.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template