ソースを参照

Use strongDelegate to fix error: weak property may be unpredictably set to nil

Myles Abbott 11 年 前
コミット
e77fc99138
1 ファイル変更2 行追加1 行削除
  1. 2 1
      Masonry/MASCompositeConstraint.m

+ 2 - 1
Masonry/MASCompositeConstraint.m

@@ -39,7 +39,8 @@
 }
 
 - (MASConstraint *)constraint:(MASConstraint __unused *)constraint addConstraintWithLayoutAttribute:(NSLayoutAttribute)layoutAttribute {
-    MASConstraint *newConstraint = [self.delegate constraint:self addConstraintWithLayoutAttribute:layoutAttribute];
+    id<MASConstraintDelegate> strongDelegate = self.delegate;
+    MASConstraint *newConstraint = [strongDelegate constraint:self addConstraintWithLayoutAttribute:layoutAttribute];
     newConstraint.delegate = self;
     [self.childConstraints addObject:newConstraint];
     return newConstraint;