更新Dictionary中的值

时间:2012-09-13 04:07:57

标签: objective-c

我已经设置了我自己的类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];

有什么想法吗?

0 个答案:

没有答案