Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c copyWithZone错误_Objective C_Memory Management - Fatal编程技术网

Objective c copyWithZone错误

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 当执行代码时,我得到以

我使用以下代码实例化view SenderPlayerViewController并传递对象“session”:

view SenderPlayerViewController的头文件是:

@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;