Я анализирую приложение iOS 4 для iPhone и получаю этот журнал:
Leaked Object # Address Size Responsible Library Responsible Frame
BlogEntry,9 < multiple > 288 Bytes Paula -[BlogViewController dataReceived]
BlogEntry,1 0x9a11700 32 Bytes Paula -[BlogViewController dataReceived]
BlogEntry,1 0x9a33e30 32 Bytes Paula -[BlogViewController dataReceived]
BlogEntry,1 0x9a44b80 32 Bytes Paula -[BlogViewController dataReceived]
BlogEntry,1 0x9a47950 32 Bytes Paula -[BlogViewController dataReceived]
BlogEntry,1 0x9a4b510 32 Bytes Paula -[BlogViewController dataReceived]
BlogEntry,1 0x9a5e840 32 Bytes Paula -[BlogViewController dataReceived]
BlogEntry,1 0x9a5e8c0 32 Bytes Paula -[BlogViewController dataReceived]
BlogEntry,1 0x9a647c0 32 Bytes Paula -[BlogViewController dataReceived]
BlogEntry,1 0x9a74ee0 32 Bytes Paula -[BlogViewController dataReceived]
Данные BlogViewControllerПоступил следующий метод:
- (void) dataReceived
{
NSArray* data = [conn.parsedData objectForKey:kRootKey];
blogEntries = [[NSMutableArray alloc] initWithCapacity:data.count];
NSDateFormatter *df = [[NSDateFormatter alloc] init];
[df setDateFormat:@"yyyy-MM-dd"];
NSTimeZone *timezone = [NSTimeZone timeZoneWithAbbreviation:@"GMT"];
[df setTimeZone:timezone];
for (int i = 0; i < data.count; i++)
{
NSDictionary* object = [data objectAtIndex:i];
NSString* titulo = [object objectForKey:kTituloKey];
NSString* texto = [object objectForKey:kTextoKey];
NSDate* fecha = [df dateFromString: [object objectForKey:kFechaKey]];
NSString* foto = [NSString stringWithFormat:@"%@%@", kPhotoURLPrefix, [object objectForKey:kFotoKey]];
BlogEntry* blogE = [[BlogEntry alloc] initWithTitle:titulo
text:texto
date:fecha
photo:foto];
[blogEntries addObject:blogE];
[blogE release];
}
[df release];
[blogList reloadData];
loadingView.hidden = YES;
}
Но я думаю, что проблема в том,в классе BlogEntry:
BlogEntry.h
@interface BlogEntry : NSObject
{
NSString* title;
NSString* text;
NSDate* date;
NSString* photo;
}
@property (nonatomic, readonly) NSString* title;
@property (nonatomic, readonly) NSString* text;
@property (nonatomic, readonly) NSString* photo;
@property (nonatomic, readonly) NSDate* date;
- (id)initWithTitle:(NSString*)titulo
text:(NSString*)texto
date:(NSDate*)fecha
photo:(NSString*)foto;
@end
BlogEntry.m
#import "BlogEntry.h"
@implementation BlogEntry
@synthesize title;
@synthesize text;
@synthesize date;
@synthesize photo;
- (id)initWithTitle:(NSString*)titulo
text:(NSString*)texto
date:(NSDate*)fecha
photo:(NSString*)foto
{
if (self = [super init])
{
title = [titulo copy];
text = [texto copy];
date = [fecha retain];
photo = [foto copy];
}
return self;
}
- (void) dealloc
{
[title release];
[text release];
[date release];
[photo release];
[super dealloc];
}
@end
Знаете ли вы, гдемоя утечка памяти?Я не могу его найти.