0
我的应用程序在成功切换到视图时终止于模拟器。我确定它很容易,这里是终止应用的视图中的.m文件。也许有些东西没有释放。它不会在控制台中抛出错误,页面加载,坐下几秒钟,然后在调试器中终止并引发mach_msg_trap。如果我点击播放按钮,它将继续。应用程序终止且没有错误
@implementation ProspectViewController
@synthesize jsonArray;
- (void)viewDidLoad {
[super viewDidLoad];
NSURL *jsonURL = [NSURLURLWithString:@"https://www.mysite.php"];
NSString *jsonData = [[NSString alloc] initWithContentsOfURL:jsonURL];
self.jsonArray = [jsonData JSONValue];
[jsonURL release];
[jsonData release];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [jsonArray count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSDictionary *infoDictionary = [self.jsonArray objectAtIndex:indexPath.row];
static NSString *Prospects = @"agencyname";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:Prospects];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:Prospects] autorelease];
}
// setting the text
cell.text = [infoDictionary objectForKey:@"agencyname"];
self.navigationItem.title = @"Prospects";
// Set up the cell
return cell;
}
ir应该是因为(或两者)这些语句[agencyName release]; [lblText release]; – samfisher 2011-12-26 08:52:48
你可以发布崩溃日志吗? – Ilanchezhian 2011-12-26 09:10:50
放置[super viewDidLoad];在方法的开始。 – Max 2011-12-26 11:10:57