I have this log error when I tap in a uisearchbar (ios 7)
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: ' -[NSBigMutableString replaceCharactersInRange:withString:]: nil argument'
*** First throw call stack:
(
0 CoreFoundation 0x02c905e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x02a138b6 objc_exception_throw + 44
2 CoreFoundation 0x02c903bb +[NSException raise:format:] + 139
3 Foundation 0x0243863e -[NSBigMutableString replaceCharactersInRange:withString:] + 117
4 Foundation 0x02438595 -[NSConcreteMutableAttributedString replaceCharactersInRange:withAttributedString:] + 384
5 UIFoundation 0x077b49f4 __71-[NSConcreteTextStorage replaceCharactersInRange:withAttributedString:]_block_invoke + 68
6 UIFoundation 0x077b492f -[NSConcreteTextStorage replaceCharactersInRange:withAttributedString:] + 121
7 Foundation 0x02462d46 -[NSMutableAttributedString setAttributedString:] + 90
8 UIKit 0x016794e2 __65-[UIFieldEditor setAttributedText:andSetCaretSelectionAfterText:]_block_invoke + 53
9 UIFoundation 0x077b2491 -[NSTextStorage coordinateEditing:] + 48
10 UIKit 0x01679375 -[UIFieldEditor setAttributedText:andSetCaretSelectionAfterText:] + 151
11 UIKit 0x0167969b -[UIFieldEditor setAttributedText:] + 48
12 UIKit 0x01c5e3f5 -[UITextField willAttachFieldEditor:] + 340
13 UIKit 0x016784d5 -[UIFieldEditor becomeFieldEditorForView:] + 927
14 UIKit 0x01c55643 -[UITextField _becomeFirstResponder] + 160
15 UIKit 0x0184441a -[UISearchBarTextField _becomeFirstResponder] + 98
16 UIKit 0x01c554a1 -[UITextField __resumeBecomeFirstResponder] + 53
17 UIKit 0x0184466e __45-[UISearchBarTextField _becomeFirstResponder]_block_invoke + 259
18 UIKit 0x01844563 -[UISearchBarTextField _becomeFirstResponder] + 427
19 UIKit 0x016d2585 -[UIResponder becomeFirstResponder] + 400
20 UIKit 0x015d5d0b -[UIView(Hierarchy) becomeFirstResponder] + 114
21 UIKit 0x01c550e3 -[UITextField becomeFirstResponder] + 51
22 UIKit 0x018415b0 -[UISearchBar(UISearchBarStatic) becomeFirstResponder] + 42
23 UIKit 0x0183f9ef -[UISearchBar tappedSearchBar:] + 57
24 UIKit 0x018f0f8c _UIGestureRecognizerSendActions + 230
25 UIKit 0x018efc00 -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 383
26 UIKit 0x018f166d -[UIGestureRecognizer _delayedUpdateGesture] + 60
27 UIKit 0x018f4bcd ___UIGestureRecognizerUpdate_block_invoke + 57
28 UIKit 0x018f4b4e _UIGestureRecognizerRemoveObjectsFromArrayAndApplyBlocks + 317
29 UIKit 0x018eb248 _UIGestureRecognizerUpdate + 199
30 UIKit 0x015b7d4a -[UIWindow _sendGesturesForEvent:] + 1291
31 UIKit 0x015b8c6a -[UIWindow sendEvent:] + 1030
32 UIKit 0x0158ca36 -[UIApplication sendEvent:] + 242
33 UIKit 0x01576d9f _UIApplicationHandleEventQueue + 11421
34 CoreFoundation 0x02c198af __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
35 CoreFoundation 0x02c1923b __CFRunLoopDoSources0 + 235
36 CoreFoundation 0x02c3630e __CFRunLoopRun + 910
37 CoreFoundation 0x02c35b33 CFRunLoopRunSpecific + 467
38 CoreFoundation 0x02c3594b CFRunLoopRunInMode + 123
39 GraphicsServices 0x0302d9d7 GSEventRunModal + 192
40 GraphicsServices 0x0302d7fe GSEventRun + 104
41 UIKit 0x0157994b UIApplicationMain + 1225
42 Mobile4Job 0x00002b5d main + 141
43 libdyld.dylib 0x03451725 start + 0
)
libc++abi.dylib: terminating with uncaught exception of type NSException
I never see something like that and I can't fix it.
From the stack trace a assume that you want to rebuild the text entered in the search bar, and you try to replace a string in a range with other string, and it seems that your other string is nil. Please check the the string that you are using, one of them is nil
I found the problem, I have an UITextfield implementation:
#implementation UITextField (clearCustomButton)
- (id)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if (self) {
}
return self;
}
- (void)awakeFromNib{
self.clearButtonMode = UITextFieldViewModeWhileEditing;
}
- (CGRect)clearButtonRectForBounds:(CGRect)bounds{
return CGRectMake(bounds.size.width - 20, (bounds.size.height - 14)/2, 14, 14);
}
#end
if I delete :
- (id)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if (self) {
}
return self;
}
it works. By the way, thanks to #danypata
Related
I'm very new to Swift - having some trouble doing the simple task of displaying a document in a PDFView. I am not using Storyboards or IBOutlets etc. Any idea why the below is crashing?
I have tried referencing an external link, but it gives me the same error. The PDF exists in the bundle directory.
import UIKit
import PDFKit
class ViewController: UIViewController {
private var pdfView = PDFView()
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
let myNewView = PDFView(frame: CGRect(x: 10, y: 100, width: 500, height: 500))
// Add border to UIView
myNewView.layer.borderWidth=2
// Change UIView Border Color to Red
myNewView.layer.borderColor = UIColor.red.cgColor
guard let path = Bundle.main.path(forResource: "CV", ofType: "pdf") else { return }
let url = URL(fileURLWithPath: path)
let document = PDFDocument(url: url)
myNewView.document = document
// Add UIView as a Subview
self.view.addSubview(myNewView)
}
}
Build succeeds. But I get the below.
2019-06-13 17:49:35.702174+0100 Appp[81235:19343962] * Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan nan]'
* First throw call stack:
(
0 CoreFoundation 0x00000001083446fb exceptionPreprocess + 331
1 libobjc.A.dylib 0x0000000106250ac5 objc_exception_throw + 48
2 CoreFoundation 0x0000000108344555 +[NSException raise:format:] + 197
3 QuartzCore 0x000000010b4072ae _ZN2CA5Layer12set_positionERKNS_4Vec2IdEEb + 140
4 QuartzCore 0x000000010b3f668b -[CALayer setPosition:] + 57
5 QuartzCore 0x000000010b3f6de3 -[CALayer setFrame:] + 560
6 PDFKit 0x0000000107135097 -[PDFPageLayerTile initWithFrame:forPageLayer:withRenderingTransform:tileContentsScale:generationID:] + 168
7 PDFKit 0x000000010713a805 -[PDFPageLayer _updateTiles] + 3439
8 PDFKit 0x0000000107135d8e -[PDFPageLayer setNeedsTilesUpdate] + 87
9 PDFKit 0x000000010714a97d -[PDFPageView setNeedsTilesUpdate] + 48
10 PDFKit 0x000000010714c816 -[PDFPageView setFrame:] + 334
11 PDFKit 0x000000010714311c -[PDFDocumentView createPageViewForPageAtIndex:] + 764
12 PDFKit 0x0000000107144326 -[PDFDocumentView updateVisibility] + 1726
13 PDFKit 0x00000001071b376f -[PDFView resizeDisplayView:] + 517
14 PDFKit 0x00000001071accdf -[PDFView layoutDocumentView] + 464
15 PDFKit 0x00000001071a836a -[PDFView setDocument:waitDuration:] + 1246
16 Appp 0x000000010596c4d1 $s7Appp14ViewControllerC11viewDidLoadyyF + 1441
17 Appp 0x000000010596c7b4 $s7Appp14ViewControllerC11viewDidLoadyyFTo + 36
18 UIKitCore 0x000000010d0ec43b -[UIViewController loadViewIfRequired] + 1183
19 UIKitCore 0x000000010d0ec868 -[UIViewController view] + 27
20 UIKitCore 0x000000010d724c33 -[UIWindow addRootViewControllerViewIfPossible] + 122
21 UIKitCore 0x000000010d725327 -[UIWindow _setHidden:forced:] + 289
22 UIKitCore 0x000000010d737f86 -[UIWindow makeKeyAndVisible] + 42
23 UIKitCore 0x000000010d6e7f1c -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4555
24 UIKitCore 0x000000010d6ed0c6 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1617
25 UIKitCore 0x000000010cf326d6 __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 904
26 UIKitCore 0x000000010cf3afce +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
27 UIKitCore 0x000000010cf322ec -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 236
28 UIKitCore 0x000000010cf32c48 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 1091
29 UIKitCore 0x000000010cf30fba __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 782
30 UIKitCore 0x000000010cf30c71 -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 433
31 UIKitCore 0x000000010cf359b6 __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 576
32 UIKitCore 0x000000010cf36610 _performActionsWithDelayForTransitionContext + 100
33 UIKitCore 0x000000010cf3571d -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 223
34 UIKitCore 0x000000010cf3a6d0 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
35 UIKitCore 0x000000010d6eb9a8 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 514
36 UIKitCore 0x000000010d2a2dfa -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 361
37 FrontBoardServices 0x00000001135df125 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 448
38 FrontBoardServices 0x00000001135e8ed6 __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 283
39 FrontBoardServices 0x00000001135e8700 __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 53
40 libdispatch.dylib 0x00000001096d7db5 _dispatch_client_callout + 8
41 libdispatch.dylib 0x00000001096db2ba _dispatch_block_invoke_direct + 300
42 FrontBoardServices 0x000000011361a146 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK + 30
43 FrontBoardServices 0x0000000113619dfe -[FBSSerialQueue _performNext] + 451
44 FrontBoardServices 0x000000011361a393 -[FBSSerialQueue _performNextFromRunLoopSource] + 42
45 CoreFoundation 0x00000001082abbe1 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17
46 CoreFoundation 0x00000001082ab463 __CFRunLoopDoSources0 + 243
47 CoreFoundation 0x00000001082a5b1f __CFRunLoopRun + 1231
48 CoreFoundation 0x00000001082a5302 CFRunLoopRunSpecific + 626
49 GraphicsServices 0x00000001107c62fe GSEventRunModal + 65
50 UIKitCore 0x000000010d6eeba2 UIApplicationMain + 140
51 Appp 0x000000010596f68b main + 75
52 libdyld.dylib 0x000000010974c541 start + 1
53 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
If you move myNewView.document = document to viewDidAppear: instead of viewDidLoad, the document will load without issue.
Unfortunately, there were changes to iOS between 12.1 and 12.2 that make this necessary.
In my main storyboard i have my firstViewController then secondViewController and my pageViewController is third.
I am connecting all of them using seque Modal.
First and Second is working but my third is showing me an error.
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Storyboard (<UIStoryboard: 0x7fb15bca4dd0>) doesn't contain a view controller with identifier 'FirstViewController''
*** First throw call stack:
(
0 CoreFoundation 0x0000000108ba7f65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010aa62deb objc_exception_throw + 48
2 UIKit 0x0000000109ccc5d4 -[UIStoryboard instantiateInitialViewController] + 0
3 0x00000001089b422d _TFC8test23SkillPageViewControllerP33_B1A346F97B9DE8BA73F8676576C06E1324newColoredViewControllerfS0_FSSCSo16UIViewController + 365
4 0x00000001089b65cc _TFFC8test23SkillPageViewControllerg22orderedViewControllersGSaCSo16UIViewController_U_FT_GSaS1__ + 92
5 0x00000001089b2f75 _TFC8test23SkillPageViewControllerg22orderedViewControllersGSaCSo16UIViewController_ + 325
6 0x00000001089b3229 _TFC8test23SkillPageViewController11viewDidLoadfS0_FT_T_ + 313
7 0x00000001089b35e2 _TToFC8test23SkillPageViewController11viewDidLoadfS0_FT_T_ + 34
8 UIKit 0x0000000109775931 -[UIViewController loadViewIfRequired] + 1344
9 UIKit 0x0000000109775c7d -[UIViewController view] + 27
10 UIKit 0x0000000109edbb2c -[_UIFullscreenPresentationController _setPresentedViewController:] + 87
11 UIKit 0x000000010974603a -[UIPresentationController initWithPresentedViewController:presentingViewController:] + 133
12 UIKit 0x00000001097885c4 -[UIViewController _presentViewController:withAnimationController:completion:] + 3930
13 UIKit 0x000000010978b878 -[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 489
14 UIKit 0x000000010978b387 -[UIViewController presentViewController:animated:completion:] + 179
15 UIKit 0x0000000109ce2af3 __67-[UIStoryboardModalSegueTemplate newDefaultPerformHandlerForSegue:]_block_invoke + 243
16 UIKit 0x0000000109cd1189 -[UIStoryboardSegueTemplate _performWithDestinationViewController:sender:] + 460
17 UIKit 0x0000000109cd0f8c -[UIStoryboardSegueTemplate _perform:] + 82
18 UIKit 0x0000000109cd1250 -[UIStoryboardSegueTemplate perform:] + 156
19 UIKit 0x00000001095ec1fa -[UIApplication sendAction:to:from:forEvent:] + 92
20 UIKit 0x0000000109750504 -[UIControl sendAction:to:forEvent:] + 67
21 UIKit 0x00000001097507d0 -[UIControl _sendActionsForEvents:withEvent:] + 311
22 UIKit 0x000000010974f906 -[UIControl touchesEnded:withEvent:] + 601
23 UIKit 0x0000000109656aa3 -[UIWindow _sendTouchesForEvent:] + 835
24 UIKit 0x0000000109657691 -[UIWindow sendEvent:] + 865
25 UIKit 0x0000000109609752 -[UIApplication sendEvent:] + 263
26 UIKit 0x00000001095e4fcc _UIApplicationHandleEventQueue + 6693
27 CoreFoundation 0x0000000108ad40a1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
28 CoreFoundation 0x0000000108ac9fcc __CFRunLoopDoSources0 + 556
29 CoreFoundation 0x0000000108ac9483 __CFRunLoopRun + 867
30 CoreFoundation 0x0000000108ac8e98 CFRunLoopRunSpecific + 488
31 GraphicsServices 0x000000010e099ad2 GSEventRunModal + 161
32 UIKit 0x00000001095ea676 UIApplicationMain + 171
33 0x00000001089ba10d main + 109
34 libdyld.dylib 0x000000010b58192d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
It is a hard guess because you didn't provide any of you code, but as the error state,
You need to set identifier for the view controller you used,in Storyboard > ViewController(one you added to storyboard,I think it is FirstViewController)>attribute inspector
there something called storyboard identifier or something like this, you need to set it. as I see you need to name it "FirstViewController"
I think you are skipping some main steps of configuring a pageviewcontroller, there is a very good tutorial here
it would be very helpful, if you check this tutorial
This is how I load the cell:
zimmerCell = (ZimmerCell*)[tableView dequeueReusableCellWithIdentifier:#"ZimmerCell"];
if (zimmerCell == nil) {
ZimmerCell* loadedCell;
loadedCell = [[[NSBundle mainBundle] loadNibNamed:#"ZimmerCell" owner:self options:nil] objectAtIndex:0];
zimmerCell = [loadedCell retain];
[zimmerCell prepare];
}
return zimmerCell;
It works the first time I open the table.
When I exit the view controller and enter it again, it crashes with the following:
* Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer bounds contains NaN: [0 0;
nan 7.27683e-38]'
* Call stack at first throw: ( 0 CoreFoundation 0x01a44be9 exceptionPreprocess + 185 1 libobjc.A.dylib
0x01b995c2 objc_exception_throw + 47 2 CoreFoundation
0x019fd628 +[NSException raise:format:arguments:] + 136 3
CoreFoundation 0x019fd59a +[NSException
raise:format:] + 58 4 QuartzCore
0x008b63ee _ZL16CALayerSetBoundsP7CALayerRKN2CA4RectEb + 227 5
QuartzCore 0x008b62b6 -[CALayer setBounds:] +
122 6 UIKit 0x0121eac0 -[UIView
_createLayerWithFrame:] + 401 7 UIKit 0x0121a13b UIViewCommonInitWithFrame + 421 8 UIKit
0x0121b063 -[UIView initWithFrame:] + 113 9 UIKit
0x013ae909 -[UITableViewCell initWithCoder:] + 1218 10 PrivatQuadrat
0x00021e87 -[ZimmerCell initWithCoder:] + 62 11 UIKit
0x013e0265 -[UIClassSwapper initWithCoder:] + 237 12 UIKit
0x014c69e4 UINibDecoderDecodeObjectForValue + 2592 13 UIKit
0x014c7693 -[UINibDecoder decodeObjectForKey:] + 398 14 UIKit
0x013dff43 -[UIRuntimeConnection initWithCoder:] + 212 15 UIKit
0x014c69e4 UINibDecoderDecodeObjectForValue + 2592 16 UIKit
0x014c62dc UINibDecoderDecodeObjectForValue + 792 17 UIKit
0x014c7693 -[UINibDecoder decodeObjectForKey:] + 398 18 UIKit
0x013df200 -[UINib instantiateWithOwner:options:] + 804 19 UIKit
0x013e1081 -[NSBundle(UINSBundleAdditions)
loadNibNamed:owner:options:] + 168 20 PrivatQuadrat
0x00021401 -[ErweitertViewController tableView:cellForRowAtIndexPath:]
+ 202 21 UIKit 0x0125d7fa -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] + 634 22 UIKit 0x0125377f -[UITableView(UITableViewInternal)
_createPreparedCellForGlobalRow:] + 75 23 UIKit 0x01268450 -[UITableView(_UITableViewPrivate) _updateVisibleCellsNow:]
+ 1561 24 UIKit 0x01260538 -[UITableView layoutSubviews] + 242 25 QuartzCore 0x008bc451 -[CALayer layoutSublayers] + 181 26 QuartzCore
0x008bc17c CALayerLayoutIfNeeded + 220 27 QuartzCore
0x008b537c _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 310
28 QuartzCore 0x008b50d0
_ZN2CA11Transaction6commitEv + 292 29 QuartzCore 0x008e57d5
_ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 99 30 CoreFoundation 0x01a25fbb
__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 27 31 CoreFoundation 0x019bb0e7 __CFRunLoopDoObservers
+ 295 32 CoreFoundation 0x01983bd7 __CFRunLoopRun + 1575 33 CoreFoundation 0x01983240 CFRunLoopRunSpecific + 208 34 CoreFoundation
0x01983161 CFRunLoopRunInMode + 97 35 GraphicsServices
0x02487268 GSEventRunModal + 217 36 GraphicsServices
0x0248732d GSEventRun + 115 37 UIKit
0x011f842e UIApplicationMain + 1160 38 PrivatQuadrat
0x00002184 main + 102 39 PrivatQuadrat
0x00002115 start + 53
Any ideas?
I get the below error when I test my application on my iPhone, yet the error doesnt occur in the Simulator. Its when I load up my rootViewController which is a UITableView. I am relatively new to iOS programming, and I was just wondering if anybody could shed any light on it!
Regards,
Michael.
Use this code to go to my RootView.
- (IBAction)goToRootView {
RootViewController *rootViewController = [[RootViewController alloc] initWithStyle:UITableViewStyleGrouped];
[self.navigationController pushViewController:rootViewController animated:YES];
[rootViewController release];
}
2011-09-12 14:39:55.951 LeagueProject[773:707] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSMutableArray objectAtIndex:]: index 0 beyond bounds for empty array'
*** Call stack at first throw:
(
0 CoreFoundation 0x3684b64f __exceptionPreprocess + 114
1 libobjc.A.dylib 0x33aa4c5d objc_exception_throw + 24
2 CoreFoundation 0x367b6069 -[__NSArrayM objectAtIndex:] + 184
3 LeagueProject 0x0000302f -[RootViewController tableView:numberOfRowsInSection:] + 58
4 UIKit 0x356827c7 -[UISectionRowData refreshWithSection:tableView:tableViewRowData:] + 1338
5 UIKit 0x356836bb -[UITableViewRowData rectForFooterInSection:] + 66
6 UIKit 0x356835f5 -[UITableViewRowData heightForTable] + 40
7 UIKit 0x35683453 -[UITableView(_UITableViewPrivate) _updateContentSize] + 206
8 UIKit 0x3567ebc9 -[UITableView _rectChangedWithNewSize:oldSize:] + 384
9 UIKit 0x3567d833 -[UITableView setFrame:] + 158
10 UIKit 0x35684e0f -[UIView(Geometry) resizeWithOldSuperviewSize:] + 274
11 UIKit 0x356510bd -[UIView(Geometry) resizeSubviewsWithOldSize:] + 120
12 UIKit 0x356364e9 -[UIView(Geometry) setFrame:] + 336
13 UIKit 0x35688193 -[UIViewControllerWrapperView setFrame:] + 62
14 UIKit 0x35676079 -[UINavigationController _startTransition:fromViewController:toViewController:] + 960
15 UIKit 0x35675c43 -[UINavigationController _startDeferredTransitionIfNeeded] + 182
16 UIKit 0x35667d5d -[UINavigationController pushViewController:transition:forceImmediate:] + 640
17 UIKit 0x35667ad3 -[UINavigationController pushViewController:animated:] + 34
18 LeagueProject 0x0000917d -[splashView goToRootView] + 116
19 CoreFoundation 0x367bb571 -[NSObject(NSObject) performSelector:withObject:withObject:] + 24
20 UIKit 0x3564dec9 -[UIApplication sendAction:to:from:forEvent:] + 84
21 UIKit 0x3564de69 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 32
22 UIKit 0x3564de3b -[UIControl sendAction:to:forEvent:] + 38
23 UIKit 0x3564db8d -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 356
24 UIKit 0x3564e423 -[UIControl touchesEnded:withEvent:] + 342
25 UIKit 0x3564cbf5 -[UIWindow _sendTouchesForEvent:] + 368
26 UIKit 0x3564c56f -[UIWindow sendEvent:] + 262
27 UIKit 0x35635313 -[UIApplication sendEvent:] + 298
28 UIKit 0x35634c53 _UIApplicationHandleEvent + 5090
29 GraphicsServices 0x35f6fe77 PurpleEventCallback + 666
30 CoreFoundation 0x36822a97 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 26
31 CoreFoundation 0x3682483f __CFRunLoopDoSource1 + 166
32 CoreFoundation 0x3682560d __CFRunLoopRun + 520
33 CoreFoundation 0x367b5ec3 CFRunLoopRunSpecific + 230
34 CoreFoundation 0x367b5dcb CFRunLoopRunInMode + 58
35 GraphicsServices 0x35f6f41f GSEventRunModal + 114
36 GraphicsServices 0x35f6f4cb GSEventRun + 62
37 UIKit 0x3565fd69 -[UIApplication _run] + 404
38 UIKit 0x3565d807 UIApplicationMain + 670
39 LeagueProject 0x000025a7 main + 82
40 LeagueProject 0x00002550 start + 40
)
terminate called after throwing an instance of 'NSException'
Your error is an index 0 beyond bounds for empty array error. Put breakpoints on the lines where you access arrays. When you find out which array is causing the problem, either the solution will be trivial, or you can add a bit more to your question and ask for further help.
It looks like the problem is in your implementation of [RootViewController tableView:numberOfRowsInSection:]. You are trying to access a member of a NSMutableArray that is empty - hence the error 'index 0 beyond bounds for empty array'.
This is the error i'm getting when i try and show a view controller modally inside my app:
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<KVPasscodeViewController 0x8b815a0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key instructionLabel.'
*** Call stack at first throw:
(
0 CoreFoundation 0x011185a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x0126c313 objc_exception_throw + 44
2 CoreFoundation 0x011184e1 -[NSException raise] + 17
3 Foundation 0x00aea677 _NSSetUsingKeyValueSetter + 135
4 Foundation 0x00aea5e5 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 285
5 UIKit 0x0056630c -[UIRuntimeOutletConnection connect] + 112
6 CoreFoundation 0x0108e8cf -[NSArray makeObjectsPerformSelector:] + 239
7 UIKit 0x00564d23 -[UINib instantiateWithOwner:options:] + 1041
8 UIKit 0x00566ab7 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
9 UIKit 0x0041c628 -[UIViewController _loadViewFromNibNamed:bundle:] + 70
10 UIKit 0x0041a134 -[UIViewController loadView] + 120
11 UIKit 0x0041a00e -[UIViewController view] + 56
12 UIKit 0x00418482 -[UIViewController contentScrollView] + 42
13 UIKit 0x00428f25 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 48
14 UIKit 0x00427555 -[UINavigationController _layoutViewController:] + 43
15 UIKit 0x00428870 -[UINavigationController _startTransition:fromViewController:toViewController:] + 524
16 UIKit 0x0042332a -[UINavigationController _startDeferredTransitionIfNeeded] + 266
17 UIKit 0x0053e2e9 -[UILayoutContainerView layoutSubviews] + 226
18 QuartzCore 0x002a6a5a -[CALayer layoutSublayers] + 181
19 QuartzCore 0x002a8ddc CALayerLayoutIfNeeded + 220
20 QuartzCore 0x002a8ed0 -[CALayer layoutIfNeeded] + 111
21 UIKit 0x0041b58a -[UIViewController window:willAnimateRotationToInterfaceOrientation:duration:] + 587
22 UIKit 0x0039255f -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 4347
23 UIKit 0x00619619 -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:] + 1381
24 UIKit 0x0041e65d -[UIViewController presentModalViewController:withTransition:] + 3478
25 DearMe 0x00011ca1 -[NotificationViewController addPasscode] + 273
26 UIKit 0x0036a4fd -[UIApplication sendAction:to:from:forEvent:] + 119
27 UIKit 0x003fa799 -[UIControl sendAction:to:forEvent:] + 67
28 UIKit 0x003fcc2b -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
29 UIKit 0x003fb7d8 -[UIControl touchesEnded:withEvent:] + 458
30 UIKit 0x0038eded -[UIWindow _sendTouchesForEvent:] + 567
31 UIKit 0x0036fc37 -[UIApplication sendEvent:] + 447
32 UIKit 0x00374f2e _UIApplicationHandleEvent + 7576
33 GraphicsServices 0x015f2992 PurpleEventCallback + 1550
34 CoreFoundation 0x010f9944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
35 CoreFoundation 0x01059cf7 __CFRunLoopDoSource1 + 215
36 CoreFoundation 0x01056f83 __CFRunLoopRun + 979
37 CoreFoundation 0x01056840 CFRunLoopRunSpecific + 208
38 CoreFoundation 0x01056761 CFRunLoopRunInMode + 97
39 GraphicsServices 0x015f11c4 GSEventRunModal + 217
40 GraphicsServices 0x015f1289 GSEventRun + 115
41 UIKit 0x00378c93 UIApplicationMain + 1160
42 DearMe 0x000029df main + 127
43 DearMe 0x00002955 start + 53
44 ??? 0x00000001 0x0 + 1
)
terminate called after throwing an instance of 'NSException'
Any ideas about why this might be caused?
EDIT: The code which gives the error:
KVPasscodeViewController *passcodeController = [[KVPasscodeViewController alloc] init];
passcodeController.delegate = self;
UINavigationController *passcodeNavigationController = [[UINavigationController alloc] initWithRootViewController:passcodeController];
[self.navigationController presentModalViewController:passcodeNavigationController animated:YES];
[passcodeNavigationController release];
[passcodeController release];
This is caused because you have an outlet pointing at 'instructionLabel' in the XIB for that view controller.
You have an .xib file that is most likely pointing to a nonexistent label. This typically happens if you add a UILabel in Interface Builder, attach it to your code where instructionLabel exists, then later remove instructionLabel from the code, but forget to update the .xib.