我有这个非常奇怪的问题,我是Objective-c的新手,它可能来自我还不理解的深度.
所以,在我的头文件中,我声明了变量
NSString *curTitle;
Run Code Online (Sandbox Code Playgroud)
然后在.m文件中我合成它:
curTitle = [[NSString alloc] init];
Run Code Online (Sandbox Code Playgroud)
在其他方法之后我分配它:
curTitle = string; // string is an instance of NSString
Run Code Online (Sandbox Code Playgroud)
在我试图分配的那天结束时
slide.title = curTitle; //slide is a managed object (CoreData)
Run Code Online (Sandbox Code Playgroud)
我收到此错误:***由于未捕获的异常'NSInvalidArgumentException'终止应用程序,原因:'属性的值不可接受的类型:property ="title"; 期望的类型= NSString; 给定type = __NSCFDictionary; value = {}.'
有趣的事实,在iphone SDK 3.2中它工作,但在我安装SDK 4后,我有这个错误
另一个有趣的事实是,如果我的类的curTitle属性(使用@property和@synthesize)它也有效
有任何想法吗?谢谢