编辑代码

#import <Foundation/Foundation.h>

// -------------------------
// @class MyObjectB;
 
// @interface MyObjectA : NSObject
 
// @property (nonatomic, strong) MyObjectB *objectB;
 
// @end
 
// @implementation MyObjectA
 
// - (void)dealloc
// {
//     NSLog(@"%s",__func__);
// }
 
// @end

// // -------------------------
 
// @interface MyObjectB : NSObject
 
// @property (nonatomic, strong) MyObjectA *objectA;
 
// @end
 
// @implementation MyObjectB
 
// - (void)dealloc
// {
//     NSLog(@"%s",__func__);
// }
// @end

// -------------------------

int main(int argc, char* argv[]) {
    printf("Objc 循环应用1");
    // MyObjectA *objectA = [[MyObjectA alloc]init];
    // MyObjectB *objectB = [[MyObjectB alloc]init];
    
    // objectA.objectB = objectB;
    // objectB.objectA = objectA;
 

    // objectB.objectA = nil;

    // objectB = nil;
    // objectA = nil;

    return 0;
}