Objective c copyWithZone错误
我使用以下代码实例化view SenderPlayerViewController并传递对象“session”: view SenderPlayerViewController的头文件是:Objective c copyWithZone错误,objective-c,memory-management,Objective C,Memory Management,我使用以下代码实例化view SenderPlayerViewController并传递对象“session”: view SenderPlayerViewController的头文件是: @interface CentralViewController : UIViewController { Settings *settings;} @property (nonatomic, copy) GKSession *currentSession; @end 当执行代码时,我得到以
@interface CentralViewController : UIViewController {
Settings *settings;}
@property (nonatomic, copy) GKSession *currentSession;
@end
当执行代码时,我得到以下错误:
[GKSession copyWithZone:]: unrecognized selector sent to instance 0x9661200
你能帮忙吗
提前谢谢
@property (nonatomic, copy) GKSession *currentSession;
这是错误的。GKSession不是可复制对象。因此,您应该通过保留以下内容来获取对它的引用:
@property (nonatomic, retain) GKSession *currentSession;
我做了您建议的更改,但仍然收到相同的错误。很明显,从您的错误消息中,这就是问题所在。你多次做了错误的申报吗?您确定已正确重新编译所有源代码吗?
@property (nonatomic, retain) GKSession *currentSession;