알아볼 수없는 또 다른 이상한 버그가 있습니다.겉으로보기에 정상적인 NSString 필드에서 핵심 데이터가 충돌합니다.
나는 아래의 코드와 tableviewcell을 만들려고 :
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
TableViewCellController *cell = (TableViewCellController *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
[[NSBundle mainBundle] loadNibNamed:@"TableViewCell" owner:self options:nil];
cell = [_cell autorelease];
_cell = nil;
}
// Configure the cell...
int storyIndex = [indexPath indexAtPosition: [indexPath length] - 1];
Article *article = (Article *)[articles objectAtIndex: storyIndex];
cell.titleLabel.text = article.title;
cell.siteLabel.text = article.site.name;
cell.summaryLabel.text = article.description;
[article release];
return cell;
}
문제는 내가 설명 값을 제외한 값으로 라벨을 채울 수 있다는 것입니다. 마자 나는 다음과 같은 충돌 얻을처럼 :
2010-12-22 16 : 07 : 13.165 iDoms [24086 : 207] CoreData가 : 주석 :에 대한 데이터베이스에서 성취 오류 : 0x8b16dd0 프로그램은 수신 된 신호를 : "EXC_BAD_ACCESS". 경고 : 이전에 선택한 프레임을 복원 할 수 없습니다. 데이터 포맷터를 일시적으로 사용할 수 없으며 '계속'한 후에 다시 시도합니다. 이 시간에 dlopen에 전화해도 안전하지 않습니다.
62820 개의 광고 항목이 스택에 있습니다. 어디서부터 시작해야할지 모르겠습니다. 나는 Java에 익숙하다. Objective-C는 거의 이상한 버그를 제외하고는 정말 악몽이었다.
문서 클래스는 다음과 같습니다
// Article.h
#import <CoreData/CoreData.h>
@class Site;
@interface Article : NSManagedObject
{
}
@property (nonatomic, retain) NSNumber * id;
@property (nonatomic, retain) NSString * title;
@property (nonatomic, retain) NSNumber * read;
@property (nonatomic, retain) NSString * link;
@property (nonatomic, retain) NSDate * pubDate;
@property (nonatomic, retain) NSString * description;
@property (nonatomic, retain) NSDate * lastUpdate;
@property (nonatomic, retain) Site * site;
@end
및
// Article.m
#import "Article.h"
@implementation Article
@dynamic id;
@dynamic title;
@dynamic read;
@dynamic link;
@dynamic pubDate;
@dynamic description;
@dynamic lastUpdate;
@dynamic site;
@end
데이터베이스는 데이터를 포함하고, 특정 필드 단지 문자열 "Test1을을". 도움은 언제나처럼 정말로 좋습니다!
감사합니다. 제 발표문에 조금 얽매여 있고, 전체 코드를 좀더 안정적으로 만들 수 있기를 바랍니다. 나는 Objective-C에 익숙하지 않은데, Java에서 왔기 때문에 이전에 릴리스 이슈에 실제로 빠져 들지 않았습니다. –
Objective-C에서 메모리 관리를 배우는 것이 까다로울 수 있습니다. 제 2의 천성이되는 시점까지는 오랜 시간이 걸렸습니다. 처음에는 코드를 작동시키기 위해 릴리즈하라는 코멘트를 시작하는 것을 배웠고 나중에 다시 돌아와 필요한 경우 릴리즈하여 누출을 추적하려고했습니다. –
Apple 개발자가 메모리 관리 관련 문서를 보지 못했다면 다음 내용을 간략하게 살펴볼 필요가 있습니다. http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/MemoryMgmt/MemoryMgmt.html –