我有數據對象類:爲什麼我的程序在自我訪問屬性時崩潰。和一個合成訪問器?
@interface Item: NSObject {
NSString *title;
NSString *text;
}
@property (copy) NSString *title;
@property (copy) NSString *text;
@end
@implementation Item
@synthesize text;
- (void)updateText {
[email protected]"new text";
}
- (NSString *)title {
return title;
}
- (void)setTitle:(NSString *)aString {
[title release];
title = [aString copy];
}
@end
我可以使用非合成的方法時設置title
屬性就好,但是當我設置一個屬性與合成訪問器我得到在上線updateText
方法的錯誤讀取:
[email protected]"new text";
錯誤是:
*** NSInvocation: warning: object 0x462d2c0 of class '_NSZombie_CFString' does not implement methodSignatureForSelector: -- trouble ahead
*** NSInvocation: warning: object 0x462d2c0 of class '_NSZombie_CFString' does not implement doesNotRecognizeSelector: -- abort
爲什麼相同非合成的連接器工作和合成的不工作?
該對象在主線程中創建,並且從NSOperation線程訪問它時出現錯誤。
該對象在主線程中創建,並且從NSOperation線程訪問它時出現錯誤。 – Rod 2009-07-11 14:18:06