I'm having really strange crash in my application. It occurs randomly. Basically, I'm having large scroll view containing multiple UIWebViews, which I'm loading from HTML string. After some time, following crash appears:
*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSMutableArray objectAtIndex:]: index 7 beyond bounds [0 .. 6]'
*** Call stack at first throw:
(
0 CoreFoundation 0x0110dbe9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x00f025c2 objc_exception_throw + 47
2 CoreFoundation 0x011036e5 -[__NSArrayM objectAtIndex:] + 261
3 CoreFoundation 0x010866e5 -[NSMutableArray removeObject:range:identical:] + 437
4 CoreFoundation 0x01086520 -[NSMutableArray removeObject:] + 96
5 UIKit 0x0035e7c0 -[UIView(UIViewGestures) removeGestureRecognizer:] + 112
6 UIKit 0x005f85c1 -[UIWebSelectionAssistant setGestureRecognizers] + 58
7 UIKit 0x004b0d09 -[UIWebDocumentView loadHTMLString:baseURL:] + 286
8 CoreFoundation 0x0107e67d __invoking___ + 29
9 CoreFoundation 0x0107e551 -[NSInvocation invoke] + 145
10 WebCore 0x0217f3c3 _ZL15HandleAPISourcePv + 147
11 CoreFoundation 0x010ef01f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
12 CoreFoundation 0x0104d28b __CFRunLoopDoSources0 + 571
13 CoreFoundation 0x0104c786 __CFRunLoopRun + 470
14 CoreFoundation 0x0104c240 CFRunLoopRunSpecific + 208
15 CoreFoundation 0x0104c161 CFRunLoopRunInMode + 97
16 WebCore 0x02240423 _ZL12RunWebThreadPv + 499
17 libSystem.B.dylib 0x901ea85d _pthread_start + 345
18 libSystem.B.dylib 0x901ea6e2 thread_start + 34
)
terminate called after throwing an instance of 'NSException'
I really can not resolve this, because crashes are random and seem to be in CoreFoundation, which I do not controll directly. Any suggestion?
Thank you very much for any help!
Not really an answer to your issue, but: be aware that Apple recommend against putting UIWebViews inside UIScrollViews. It's certainly possible to do, in my experience, but just be warned that wacky things might happen.
Related question:
Two resizable UIWebViews inside UIScrollView
The problem is in your gesture recognizers. The UIView is attempting to remove a recognizer that is presumably not there. It accesses index 7 of the 6 element array causing the crash.
I would check any customizations of the gestures you might have done.
Related
So something happened with my Xcode where I continuously keep getting Thread 1 SIGABRT error.
I have literally tried what every message board has suggested, and don't know where to turn to next. I know its not an issue with outlets, because I ensured there was no outlet on the storyboard. I tried opening past projects (which worked perfectly fine in the past) but they too crashed with this error. It seems like there is something wrong with Xcode itself. It will always crash any project that has any elements on the storyboard.
Could anyone help and make sense of this?
2016-08-17 18:58:58.482 wazSUP[2002:41440] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Can't set default ACL before Parse is initialized.'
*** First throw call stack:
(
0 CoreFoundation 0x000000010e6f1d85 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000110624deb objc_exception_throw + 48
2 CoreFoundation 0x000000010e6f1cbd +[NSException raise:format:] + 205
3 wazSUP 0x000000010dd40f5a +[PFACL setDefaultACL:withAccessForCurrentUser:] + 175
4 wazSUP 0x000000010dd35bf1 _TFC6wazSUP11AppDelegate11applicationfTCSo13UIApplication29didFinishLaunchingWithOptionsGSqGVs10DictionaryCSo8NSObjectPs9AnyObject____Sb + 401
5 wazSUP 0x000000010dd362a4 _TToFC6wazSUP11AppDelegate11applicationfTCSo13UIApplication29didFinishLaunchingWithOptionsGSqGVs10DictionaryCSo8NSObjectPs9AnyObject____Sb + 180
6 UIKit 0x000000010f09f9ac -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 272
7 UIKit 0x000000010f0a0c0d -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3415
8 UIKit 0x000000010f0a7568 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1769
9 UIKit 0x000000010f0a4714 -[UIApplication workspaceDidEndTransaction:] + 188
10 FrontBoardServices 0x0000000111c7c8c8 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
11 FrontBoardServices 0x0000000111c7c741 -[FBSSerialQueue _performNext] + 178
12 FrontBoardServices 0x0000000111c7caca -[FBSSerialQueue _performNextFromRunLoopSource] + 45
13 CoreFoundation 0x000000010e617301 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
14 CoreFoundation 0x000000010e60d22c __CFRunLoopDoSources0 + 556
15 CoreFoundation 0x000000010e60c6e3 __CFRunLoopRun + 867
16 CoreFoundation 0x000000010e60c0f8 CFRunLoopRunSpecific + 488
17 UIKit 0x000000010f0a3f21 -[UIApplication _run] + 402
18 UIKit 0x000000010f0a8f09 UIApplicationMain + 171
19 wazSUP 0x000000010dd36f22 main + 114
20 libdyld.dylib 0x000000011112b92d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Ok, I have not seen your code so I do not know exactly what to do to fix it but I can explain Thread 1 SIGABRT to you.
The bug can be caused in 2 ways:
If you have the code for an IBOUTLET but deleted the connection from the view controller to the program or Vice Versa it will cause the bug
Also doing self.addChild(nodeName) multiple times to the same node without removing between the 2 occurrences can cause it as well.
Hope this helped.
I am getting the following error please help me with a solution. My xcode gets aborted with the following error
Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSMutableArray objectAtIndex:]: index 0 beyond bounds for empty array'
*** Call stack at first throw:
(
0 CoreFoundation 0x0140a5a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x0155e313 objc_exception_throw + 44
2 CoreFoundation 0x014000a5 -[__NSArrayM objectAtIndex:] + 261
3 UMMCelebrity 0x00043903 -[UMMFlickrView photoGallery:urlForPhotoSize:atIndex:] + 115
4 UMMCelebrity 0x0004a9d6 -[FGalleryViewController createGalleryPhotoForIndex:] + 422
5 UMMCelebrity 0x0004a5ac -[FGalleryViewController loadThumbnailImageWithIndex:] + 172
6 UMMCelebrity 0x0004a189 -[FGalleryViewController preloadThumbnailImages] + 281
7 UMMCelebrity 0x00046f84 -[FGalleryViewController loadView] + 2132
8 UIKit 0x0029d00e -[UIViewController view] + 56
9 UMMCelebrity 0x00043050 -[UMMFlickrView pushphotoview] + 192
10 UMMCelebrity 0x000446c6 -[UMMFlickrView connection:didReceiveData:] + 2230
11 Foundation 0x00996835 _NSURLConnectionDidReceiveData + 159
12 CFNetwork 0x033bde72 _ZN19URLConnectionClient21_clientDidReceiveDataEPK8__CFDataPNS_26ClientConnectionEventQueueE + 262
13 CFNetwork 0x0348a6b3 _ZN19URLConnectionClient26ClientConnectionEventQueue33processAllEventsAndConsumePayloadEP20XConnectionEventInfoI12XClientEvent18XClientEventParamsEl + 247
14 CFNetwork 0x0348a9cf _ZN19URLConnectionClient26ClientConnectionEventQueue33processAllEventsAndConsumePayloadEP20XConnectionEventInfoI12XClientEvent18XClientEventParamsEl + 1043
15 CFNetwork 0x033b5c80 _ZN19URLConnectionClient13processEventsEv + 100
16 CFNetwork 0x033b5acf _ZN17MultiplexerSource7performEv + 251
17 CoreFoundation 0x013eb8ff __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
18 CoreFoundation 0x0134988b __CFRunLoopDoSources0 + 571
19 CoreFoundation 0x01348d86 __CFRunLoopRun + 470
20 CoreFoundation 0x01348840 CFRunLoopRunSpecific + 208
21 CoreFoundation 0x01348761 CFRunLoopRunInMode + 97
22 GraphicsServices 0x018e21c4 GSEventRunModal + 217
23 GraphicsServices 0x018e2289 GSEventRun + 115
24 UIKit 0x001fbc93 UIApplicationMain + 1160
25 UMMCelebrity 0x00001d29 main + 121
26 UMMCelebrity 0x00001ca5 start + 53
)
terminate called after throwing an instance of 'NSException'
You're calling objectAtIndex: with the argument 0 on an empty NSMutableArray.
[NSMutableArray objectAtIndex:]: index 0 beyond bounds for empty array
If you know the NSMutableArray can be empty, you should consider calling count on it to see if it does indeed contain any elements, before trying to access the elements.
Obviously, there's an empty NSMutableArray in -[UMMFlickrView photoGallery:urlForPhotoSize:atIndex:] and you sent it objectAtIndex: with argument 0.
That means your NSMutableArray is empty. I think you didn't allocate the memory for NSMutableArray. Read this link, it may be helpful for you.
http://www.roseindia.net/answers/viewqa/Mobile-Applications/14614-NSMutableArray-Example-Code.html
May be on the 4th click nothing is pushed into the array, I'm not sure as I have no idea what you are trying to do.If you can add the code line that adds the object into your array, we could help you.
This error is occurring because the array is empty for sure.
*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSMutableArray objectAtIndex:]: index 18 beyond bounds [0 .. 16]'
*** Call stack at first throw:
(
0 CoreFoundation 0x02b11b99 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x02c6140e objc_exception_throw + 47
2 CoreFoundation 0x02b07695 -[__NSArrayM objectAtIndex:] + 261
3 MyPocket 0x0005efe9 -[loginLocalitems tableView:didSelectRowAtIndexPath:] + 638
4 UIKit 0x00be9a48 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1140
5 UIKit 0x00be032e -[UITableView _userSelectRowAtIndexPath:] + 219
6 Foundation 0x0037821a __NSFireDelayedPerform + 441
7 CoreFoundation 0x02af2f73 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 19
8 CoreFoundation 0x02af45b4 __CFRunLoopDoTimer + 1364
9 CoreFoundation 0x02a50dd9 __CFRunLoopRun + 1817
10 CoreFoundation 0x02a50350 CFRunLoopRunSpecific + 208
11 CoreFoundation 0x02a50271 CFRunLoopRunInMode + 97
12 GraphicsServices 0x03f4e00c GSEventRunModal + 217
13 GraphicsServices 0x03f4e0d1 GSEventRun + 115
14 UIKit 0x00b84af2 UIApplicationMain + 1160
15 MyPocket 0x000023d2 main + 84
16 MyPocket 0x00002375 start + 53
17 ??? 0x00000001 0x0 + 1
)
terminate called after throwing an instance of 'NSException'
What is the reason for the above array. This crash appears only when i select the lower cells of table view Anyone pls help
This error is telling you that your NSMutableArray has only from 0 to 16 objects inside. When you scroll to the bottom of the table and select the lower cell you are trying to access an object in the array at index higher then 16. So try to check if the array that you are using for the table is properly filled, and that you are not removing something from it at later time.
you are loading data from a mutable array?
check if the array really has 18 elements.
or if you are giving a number bigger than the actual row count in the numberOfRows inSection method
this is a range exception:
index 18 beyond bounds [0 .. 16]
as you see, it only occurs when you click the lower items
I am using ShareKit to allow the user to share their score on Twitter and Facebook in my iPhone app. However, it seems to crash shortly after sharing on either service. I get an console message which says:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFString rangeOfString:options:range:locale:]: nil argument'
*** Call stack at first throw:
(
0 CoreFoundation 0x026d6919 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x028245de objc_exception_throw + 47
2 CoreFoundation 0x0268f078 +[NSException raise:format:arguments:] + 136
3 CoreFoundation 0x0268efea +[NSException raise:format:] + 58
4 Foundation 0x0008f97b -[NSString rangeOfString:options:range:locale:] + 424
5 Foundation 0x0009de16 -[NSString rangeOfString:] + 104
6 iPhone Typer 0x00030220 -[SHKOAuthView webView:shouldStartLoadWithRequest:navigationType:] + 151
7 UIKit 0x004bb456 -[UIWebView webView:decidePolicyForNavigationAction:request:frame:decisionListener:] + 458
8 CoreFoundation 0x0264742d __invoking___ + 29
9 CoreFoundation 0x02647301 -[NSInvocation invoke] + 145
10 WebCore 0x030940f0 _ZL20HandleDelegateSourcePv + 64
11 CoreFoundation 0x026b7d7f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
12 CoreFoundation 0x026162cb __CFRunLoopDoSources0 + 571
13 CoreFoundation 0x026157c6 __CFRunLoopRun + 470
14 CoreFoundation 0x02615280 CFRunLoopRunSpecific + 208
15 CoreFoundation 0x026151a1 CFRunLoopRunInMode + 97
16 GraphicsServices 0x02e5e2c8 GSEventRunModal + 217
17 GraphicsServices 0x02e5e38d GSEventRun + 115
18 UIKit 0x00339b58 UIApplicationMain + 1160
19 iPhone Typer 0x00002894 main + 102
20 iPhone Typer 0x00002825 start + 53
)
terminate called after throwing an instance of 'NSException'
How would I fix this? Thanks.
Set a breakpoint on objc_exception_throw, then build the app for debug, run the app with breakpoints on and cause the crash again, then go up the stack to the relevant code.
Something inside SHKOAuthView webView:shouldStartLoadWithRequest:navigationType: is passing a nil argument to NSString rangeOfString. When you know what is passing the nil, it may be obvious what the problem is - failing that update your question with the relevant code and any extra information you've determined.
My iPhone app is a Tab Bar Application, which has 5 tabs. In each tab, there is a table view, embedded with navigation controller. When these table views appear, data will be loaded from database.
When I switch the tabs very fast by tapping the tab bar randomly, the app crashes sometimes.
The error is:
+[UIWindow length]: unrecognized selector sent to class 0x3e055bd4
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[UIWindow length]: unrecognized selector sent to class 0x3e055bd4'
terminate called after throwing an instance of 'NSException'
Does anyone have advices or hints about find out the reason of the problem?
P.S. I created another similar but simpler app, which cannot be crashed by this way.
More info about calling stack:
> *** Call stack at first throw:
(
0 CoreFoundation 0x31785fd3 __exceptionPreprocess + 114
1 libobjc.A.dylib 0x320118a5 objc_exception_throw + 24
2 CoreFoundation 0x31789af3 +[NSObject(NSObject) doesNotRecognizeSelector:] + 102
3 CoreFoundation 0x31788f15 ___forwarding___ + 508
4 CoreFoundation 0x3171b680 _CF_forwarding_prep_0 + 48
5 UIKit 0x3019a3ff -[UITableHeaderFooterView setText:] + 30
6 UIKit 0x3028239d -[UITableView(UITableViewInternal) _sectionHeaderView:withFrame:forSection:opaque:reuseViewIfPossible:] + 488
7 UIKit 0x30199e41 -[UITableView(UITableViewInternal) _sectionHeaderViewWithFrame:forSection:opaque:reuseViewIfPossible:] + 60
8 UIKit 0x3016bcb1 -[UITableView(_UITableViewPrivate) _updateVisibleHeadersAndFootersNow:] + 852
9 UIKit 0x3016b1a1 -[UITableView(_UITableViewPrivate) _updateVisibleCellsNow:] + 1408
10 UIKit 0x301693c1 -[UITableView layoutSubviews] + 140
11 UIKit 0x301276ab -[UIView(CALayerDelegate) _layoutSublayersOfLayer:] + 26
12 CoreFoundation 0x317117ff -[NSObject(NSObject) performSelector:withObject:] + 22
13 QuartzCore 0x321e2585 -[CALayer layoutSublayers] + 120
14 QuartzCore 0x321e233d CALayerLayoutIfNeeded + 184
15 QuartzCore 0x321e1e0f _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 210
16 QuartzCore 0x321e1b69 _ZN2CA11Transaction6commitEv + 192
17 QuartzCore 0x321e740d _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 52
18 CoreFoundation 0x3175ba49 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 16
19 CoreFoundation 0x3175d475 __CFRunLoopDoObservers + 412
20 CoreFoundation 0x3175e77b __CFRunLoopRun + 854
21 CoreFoundation 0x317078eb CFRunLoopRunSpecific + 230
22 CoreFoundation 0x317077f3 CFRunLoopRunInMode + 58
23 GraphicsServices 0x33ac26ef GSEventRunModal + 114
24 GraphicsServices 0x33ac279b GSEventRun + 62
25 UIKit 0x3011e2a7 -[UIApplication _run] + 402
26 UIKit 0x3011ce17 UIApplicationMain + 670
27 MyAPP 0x00002193 main + 70
28 MyAPP 0x00002114 start + 52
)
Most likely a dangling pointer to a former NSString now occupied by a UIWindow object. You'll have to find the lost object and probably retain it.
In XCode, select "Edit Active Executable..." under the Project menu. Select the "Arguments" tab and add an entry named "NSZombieEnabled" set to "YES" to the "Variables to be set in the environment" section.
NSZombieEnabled marks deleted objects as "Zombies" rather than reclaiming their space. When enabled, an exception is thrown any time a message is sent to a Zombie object. That should help you narrow down which object is not being retained properly.
Happy Zombie Hunting!
I can only guess that you try to call +[UIWindow length] somewhere in your code. And the method length does not exist in Apple API
Eventually, I found the problem.
I init a subview in viewWillApear: and use it in tableView:viewForHeaderInSection: and release the subview in viewDidDisappear:.
I changed the init/release into viewDidLoad: and viewDidUnload:. Then the problem is gone.
Thank both answerers and hope this answer will help others.