首先,我遵循了这个教程:three20 github tutorial
我认为我有一个内存管理问题,这会导致我的应用程序崩溃。
我认为,_properties
在我的帖子模型中,我的应用程序崩溃了。
我第一次启动我的应用程序并将视图更改为我的postsTableViewController
作品非常好。我创建了一个 TTLauncherView,改回这个视图控制器会使我的应用程序崩溃。
现在这里是我的帖子模型的一些代码
// .h
@interface postsModel : TTURLRequestModel {
NSMutableArray *_properties;
}
@property (nonatomic, readonly)NSMutableArray *properties;
// .m
@synthesize properties = _properties;
- (void)requestDidFinishLoad:(TTURLRequest*)request {
TTURLDataResponse* response = request.response;
NSString* responseBody = [[NSString alloc] initWithData: response.data encoding: NSUTF8StringEncoding];
NSDictionary *json = [responseBody JSONValue];
TT_RELEASE_SAFELY(responseBody);
NSMutableArray *resultSet = [json objectForKey:@"posts"];
TT_RELEASE_SAFELY(_properties);
_properties = [NSMutableArray arrayWithArray:resultSet];
TT_RELEASE_SAFELY(resultSet);
[super requestDidFinishLoad:request];
}
- (void)dealloc {
TT_RELEASE_SAFELY(_properties);
[super dealloc];
}
删除我的 _properties 的 tt_release 通过从此视图返回到 Launcher 视图来停止应用程序崩溃,但再次单击我的 TableView 会再次使应用程序崩溃。
对我来说写下来有点困难,因为它有很多代码。如果有帮助,我还可以将我的应用程序作为 .zip 文件提供,它现在非常基本。
感谢