【发布时间】:2010-10-07 12:08:48
【问题描述】:
-(id)init {
if (self = [super init]) {
self.name = [[NSString alloc] init];
self.type = [[NSString alloc] init];
self.phoneNumber = [[NSString alloc]init];
self.webAddress = [[NSString alloc] init];
NSMutableArray *pricesArray = [[NSMutableArray alloc] init];
NSMutableArray *poolsArray = [[NSMutableArray alloc] init];
self.prices = pricesArray;
self.pools = poolsArray;
[pricesArray release];
[poolsArray release];
//Create the address dictionaries
NSMutableDictionary *addressItems = [[NSMutableDictionary alloc] initWithObjectsAndKeys:@"", KAddressStreet1Key, @"", KAddressStreet2Key, @"", KAddressBoroughKey, @"", KAddressCityKey, @"", KAddressCountyKey, @"", KAddressPostCodeKey, @"" ,KAddressCountryKey, nil];
//Add dictionary to the array to contain address values
self.address = addressItems;
[addressItems release];
}
return self;
}
感谢EXC_BAD_ACCESS 错误,我目前正在进行大量调试..grr.
对于类 init 方法,上面的代码看起来是否合理且合乎逻辑?基本上,当我释放两个池(可变数组和字典)时,我得到了 EXC_BAD_ACCESS 错误。
【问题讨论】:
标签: iphone objective-c cocoa-touch xcode