ARC 아래에 있는 객체의 버그 해제
13519 단어 bug
* thread #1: tid = 0x31d1db, 0x0000000102e5e00b libobjc.A.dylib`objc_msgSend + 11, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x18)
frame #0: 0x0000000102e5e00b libobjc.A.dylib`objc_msgSend + 11
frame #1: 0x0000000101968212 UIKit`-[UISectionRowData refreshWithSection:tableView:tableViewRowData:] + 2353
frame #2: 0x000000010196de45 UIKit`-[UITableViewRowData rectForFooterInSection:heightCanBeGuessed:] + 320
frame #3: 0x000000010196df3a UIKit`-[UITableViewRowData heightForTable] + 56
frame #4: 0x00000001017c0af0 UIKit`-[UITableView _updateContentSize] + 381
frame #5: 0x00000001017ddecd UIKit`-[UITableView didMoveToWindow] + 65
frame #6: 0x00000001017649a0 UIKit`-[UIView(Internal) _didMoveFromWindow:toWindow:] + 1482
frame #7: 0x0000000101775333 UIKit`-[UIScrollView _didMoveFromWindow:toWindow:] + 55
frame #8: 0x000000010176468e UIKit`-[UIView(Internal) _didMoveFromWindow:toWindow:] + 696
frame #9: 0x000000010176468e UIKit`-[UIView(Internal) _didMoveFromWindow:toWindow:] + 696
frame #10: 0x000000010176468e UIKit`-[UIView(Internal) _didMoveFromWindow:toWindow:] + 696
frame #11: 0x000000010176468e UIKit`-[UIView(Internal) _didMoveFromWindow:toWindow:] + 696
frame #12: 0x000000010175d112 UIKit`__45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 125
frame #13: 0x000000010175d086 UIKit`-[UIView(Hierarchy) _postMovedFromSuperview:] + 437
frame #14: 0x0000000101766f4b UIKit`-[UIView(Internal) _addSubview:positioned:relativeTo:] + 1604
frame #15: 0x00000001017c816f UIKit`-[UITableView _addContentSubview:atBack:] + 245
frame #16: 0x00000001017e08cd UIKit`__53-[UITableView _configureCellForDisplay:forIndexPath:]_block_invoke + 2403
frame #17: 0x00000001017615ce UIKit`+[UIView(Animation) performWithoutAnimation:] + 65
frame #18: 0x00000001017dff5b UIKit`-[UITableView _configureCellForDisplay:forIndexPath:] + 312
frame #19: 0x00000001017e74cc UIKit`-[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 533
frame #20: 0x00000001017c6fb1 UIKit`-[UITableView _updateVisibleCellsNow:isRecursive:] + 2846
frame #21: 0x00000001017dce3c UIKit`-[UITableView layoutSubviews] + 213
frame #22: 0x0000000101769973 UIKit`-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 521
frame #23: 0x00000001043efde8 QuartzCore`-[CALayer layoutSublayers] + 150
frame #24: 0x00000001043e4a0e QuartzCore`CA::Layer::layout_if_needed(CA::Transaction*) + 380
frame #25: 0x00000001043e487e QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 24
frame #26: 0x000000010435263e QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 242
frame #27: 0x000000010435374a QuartzCore`CA::Transaction::commit() + 390
frame #28: 0x00000001016ee54d UIKit`-[UIApplication _reportMainSceneUpdateFinished:] + 44
frame #29: 0x00000001016ef238 UIKit`-[UIApplication _runWithMainScene:transitionContext:completion:] + 2642
frame #30: 0x00000001016edbf2 UIKit`-[UIApplication workspaceDidEndTransaction:] + 179
frame #31: 0x000000010480c2a3 FrontBoardServices`__31-[FBSSerialQueue performAsync:]_block_invoke + 16
frame #32: 0x00000001034f253c CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
frame #33: 0x00000001034e8285 CoreFoundation`__CFRunLoopDoBlocks + 341
frame #34: 0x00000001034e8045 CoreFoundation`__CFRunLoopRun + 2389
frame #35: 0x00000001034e7486 CoreFoundation`CFRunLoopRunSpecific + 470
frame #36: 0x00000001016ed669 UIKit`-[UIApplication _run] + 413
frame #37: 0x00000001016f0420 UIKit`UIApplicationMain + 1282
* frame #38: 0x0000000101513903 NiuHelper`main(argc=1, argv=0x00007fff5e7ac350) + 115 at main.m:14
frame #39: 0x000000010844d145 libdyld.dylib`start + 1
질문을 보고 애플 버그인 줄 알았는데 한 번 검색해보니 똑같은 질문에 한 네티즌이 답했다.
Sorry I never came back to this thread.
So the issue is that this nib is being loaded by a view controller through its initWithNibName:bundle: method. That method will not retain any top level objects on its own.
So your Highscore Controller object is loaded from the nib and then autoreleased, which means it goes away pretty quickly after that. So you need to retain that object. One easy way to do that is to define a property in your view controller subclass for this object (specifying 'retain' and 'IBOutlet' of course) and then connect that outlet to this Highscore Controller in IB.
자신이 여기에 VC를 만들었다는 것을 연상하여 VC의view를 인터페이스에 추가하면 이 VC에 관여하지 않습니다. VC가 방출되었습니다. 이런 autorelease의 문제에 주의해야 합니다. 같은 라인에서도 문제가 존재할 수 있습니다.
- (TopTabPage *)TopTabControl:(TopTabControl *)tabCtrl
pageAtIndex:(NSUInteger)index
{
TopTabPage *page = [[TopTabPage alloc] initWithFrame:CGRectMake(0,
0,
CGRectGetWidth(self.view.frame),
CGRectGetHeight(tabCtrl.bounds) - 30
)];
NHNewsModel *NewsModel = [self.tagListModel.result.channelList objectAtIndex:index];
NHNewsContentViewController *contentViewVC = [[NHNewsContentViewController alloc] initWithChannelID:NewsModel.getChannelID
andContentRect:page.bounds];
[page addSubview:contentViewVC.view];
// [_array addObject:contentViewVC];
return page;
}
VC retain 이후 문제 없습니다.사과의arc도 완전히 믿을 수는 없잖아.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
useState 버그 파트 I: 예기치 않은 상태 업데이트.이 질문을 명심하십시오. 이 useState 버그 시리즈 파트에서는 useState의 가장 일반적인 문제와 해결 방법에 대해 이야기하겠습니다. 이 작은 앱의 예를 들어 보겠습니다. 이것은 우리가 시연을 위해 사용할 ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.