【发布时间】:2016-08-07 14:51:53
【问题描述】:
我正在编译代码以避免 Retain Cycle,当我使用 weak 时,出现此错误:1. property of weak attribute must be of object type; 2. Unknown type name 'OrderEntry'。代码有什么问题?谢谢!
// OrderEntry.h
#import <Foundation/Foundation.h>
#import "OrderItem.h"
#import "Address.h"
@interface OrderEntry : NSObject
@property (strong, nonatomic)OrderItem *orderItem;
@property (strong, nonatomic)Address *shippingAddress;
@property (strong, nonatomic) NSString *orderID;
@end
// OrderItem.h
#import <Foundation/Foundation.h>
#import "OrderEntry.h"
@interface OrderItem : NSObject
@property (strong,nonatomic) NSString *name;
@property (weak, nonatomic) OrderEntry *entry;
@end
【问题讨论】:
标签: objective-c weak-references circular-reference