2014-12-18 8 views
0

2 개 언어로 잘 작동하는 iOS 응용 프로그램이 있습니다. 이미 현지화를 위해 NSLocalizedString을 사용하고 있다는 것을 염두에 두었습니다. 응용 프로그램의 영어 버전은 지금까지 잘 작동하지만, 시작할 때 두 번째 언어 버전이 충돌합니다. 왜?현지화 된 응용 프로그램이 NSRangeException과 충돌합니다.

내 localizable.strings 파일에 모든 NSLocalizedString을 추가하지 않았다는 점에 유의해야합니다. 게다가, 나는 두 가지 영어에 대한 두 개의 스토리 보드를 가지고있다. 어떤 도움이라도 대단히 감사하겠습니다!

2014-12-18 18:14:36.083 Coverdale[48297:60b] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI objectAtIndex:]: index 2 beyond bounds [0 .. 1]' 
*** First throw call stack: 
(
0 CoreFoundation      0x002461e4 __exceptionPreprocess + 180 
1 libobjc.A.dylib      0x020538e5 objc_exception_throw + 44 
2 CoreFoundation      0x001fa8b2 -[__NSArrayI objectAtIndex:] + 210 
3 UIKit        0x0126a35f -[UITableViewDataSource tableView:indentationLevelForRowAtIndexPath:] + 127 
4 UIKit        0x00fe3f34 -[UITableViewController tableView:indentationLevelForRowAtIndexPath:] + 61 
5 UIKit        0x00e012cf __53-[UITableView _configureCellForDisplay:forIndexPath:]_block_invoke + 1786 
6 UIKit        0x00d7581f +[UIView(Animation) performWithoutAnimation:] + 82 
7 UIKit        0x00d75868 +[UIView(Animation) _performWithoutAnimation:] + 40 
8 UIKit        0x00e00bd0 -[UITableView _configureCellForDisplay:forIndexPath:] + 108 
9 UIKit        0x00e0813d -[UITableView _createPreparedCellForGlobalRow:withIndexPath:] + 442 
10 UIKit        0x00e081f3 -[UITableView _createPreparedCellForGlobalRow:] + 69 
11 UIKit        0x00de9ece -[UITableView _updateVisibleCellsNow:] + 2428 
12 UIKit        0x00dfe6a5 -[UITableView layoutSubviews] + 213 
13 UIKit        0x00d7e964 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355 
14 libobjc.A.dylib      0x0206582b -[NSObject performSelector:withObject:] + 70 
15 QuartzCore       0x007c845a -[CALayer layoutSublayers] + 148 
16 QuartzCore       0x007bc244 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380 
17 QuartzCore       0x007bc0b0 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26 
18 QuartzCore       0x007227fa _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294 
19 QuartzCore       0x00723b85 _ZN2CA11Transaction6commitEv + 393 
20 QuartzCore       0x00724258 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92 
21 CoreFoundation      0x0020e36e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30 
22 CoreFoundation      0x0020e2bf __CFRunLoopDoObservers + 399 
23 CoreFoundation      0x001ec254 __CFRunLoopRun + 1076 
24 CoreFoundation      0x001eb9d3 CFRunLoopRunSpecific + 467 
25 CoreFoundation      0x001eb7eb CFRunLoopRunInMode + 123 
26 GraphicsServices     0x0406b5ee GSEventRunModal + 192 
27 GraphicsServices     0x0406b42b GSEventRun + 104 
28 UIKit        0x00d0ff9b UIApplicationMain + 1225 
29 Coverdale       0x0009b95d main + 141 
30 libdyld.dylib      0x028b9701 start + 1 
31 ???         0x00000001 0x0 + 1 
) 
libc++abi.dylib: terminating with uncaught exception of type NSException 
(lldb) 

편집

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 

static NSString *CellIdentifier = @"Cell"; 

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
if (cell == nil) { 
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier]; 
} 
cell.textLabel.text = @"Error"; 
if (indexPath.section == 0) { 
    if(indexPath.row == 0) 
    { /*..*/} 
} 
return cell; 
} 
+0

충돌이 발생한 부분에 코드 블록을 추가 할 수 있습니까? 당신이 그것을 좁히지 않았다면, 충돌 할 때를 잡기 위해 예외 중단 점을 설정하십시오. – Chris

+0

안녕하세요, 귀하의 회신에 감사드립니다. 불행하게도, 예외 중단 점은 나에게 단지 main.m을 보여줍니다 INT 주 (INT의는 argc를 숯불 * 변수는 argv []) { @autoreleasepool { 반환 UIApplicationMain (는 argc, argv를, 전무, NSStringFromClass ([MyAppDelegate 클래스])); }} – Faser

+0

테이블보기 데이터 원본 메서드를 게시 할 수 있습니까? 'indentationLevelForRowAtIndexPath'를 구현하면 게시 할 수 있습니다. 그렇지 않으면 문제가있을 수 있으므로 셀을 만드는 위치에 메소드를 게시하십시오. – Chris

답변

2

내가 indentationLevelForRowAtIndexPath 그냥 return 0을 구현하는 데 필요한 밝혀졌습니다.