1

我已经建立了自己的名为 myObjectClass 的类,如下所示:

@interface myObjectClass : NSObject{
    NSMutableString *theRef;
    NSMutableString *theLat;
    NSMutableString *theLong;
    NSMutableString *theDesc;
    NSMutableString *theTime;

}

@property(nonatomic,retain) NSMutableString *theRef;
@property (nonatomic, retain) NSMutableString *theLat;
@property (nonatomic, retain) NSMutableString *theLong;
@property (nonatomic, retain) NSMutableString *theDesc;
@property (nonatomic, retain) NSMutableString *theTime;


@end

当我在字典中添加新条目时,一切正常。当我尝试编辑现有条目时,它会崩溃。

myObjectClass *myRouteData = [[myObjectClass alloc]init];
[myRouteData.theRef setString:myKey.text];
[myRouteData.theLat setString:tf1.text];
[myRouteData.theLong setString:tf2.text];
[myRouteData.theDesc setString:myDesc.text];
[myRouteData.theTime setString:myTime.text];

//The values for all of the above are the correct updated values.
//crashes on next line for existing object


[[masterDelegate myData] setObject:myRouteData forKey:myKey.text];

[myRouteData release];

有任何想法吗?

4

0 回答 0