Set NSTimer to nil crash - crash

When I called NSTimer -[invalidate] method and set timer to nil, there caused carsh.The thread that I initialize NSTimer and call -[invalidate] method was the same thread.but it crashed sometimes。why?Bad access crash? This is crash log:
#0. Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x1819d4430 objc_msgSend + 16
1 MTXX 0x100d73480 -[MTBDummyWebViewViewController resetTimerAndAnimation] (MTBDummyWebViewViewController.m:135)
2 MTXX 0x100d73828 -[MTBDummyWebViewViewController webView:shouldStartLoadWithRequest:navigationType:] (MTBDummyWebViewViewController.m:176)
3 UIKit 0x18bda4f9c -[UIWebView webView:decidePolicyForNavigationAction:request:frame:decisionListener:] + 300
4 CoreFoundation 0x182779670 __invoking___ + 144
5 CoreFoundation 0x1826586cc -[NSInvocation invoke] + 292
6 CoreFoundation 0x18265d16c -[NSInvocation invokeWithTarget:] + 60
7 WebKitLegacy 0x18b811858 -[_WebSafeForwarder forwardInvocation:] + 156
8 CoreFoundation 0x1827773bc ___forwarding___ + 624
9 CoreFoundation 0x18265d01c _CF_forwarding_prep_0 + 92
10 CoreFoundation 0x182779670 __invoking___ + 144
11 CoreFoundation 0x1826586cc -[NSInvocation invoke] + 292
12 WebCore 0x18a4d34f4 HandleDelegateSource(void*) + 108
13 CoreFoundation 0x18271a2e8 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
14 CoreFoundation 0x18271a268 __CFRunLoopDoSource0 + 88
15 CoreFoundation 0x182719af0 __CFRunLoopDoSources0 + 204
16 CoreFoundation 0x1827176c8 __CFRunLoopRun + 1048
17 CoreFoundation 0x182637fb8 CFRunLoopRunSpecific + 436
18 GraphicsServices 0x1844cff84 GSEventRunModal + 100
19 UIKit 0x18bc0c2e8 UIApplicationMain + 208
20 MTXX 0x10047f6bc main (main.m:15)
21 libdyld.dylib 0x18215a56c start + 4
--
They are used like this:
[self.timeoutTimer invalidate];
self.timeoutTimer = nil;

Related

UITableViewController in iOS 8 Today Extension

I'm trying to add UITableViewController to Today Widget, but every time I drag UITableViewController to Storyboard and run the Widget it crashes with the following error.
I've tried multiple times. I've tried it by using Table View object, but problem persists.
Note: It crashes even before loading viewDidLoad() method.
2015-06-06 01:19:20.569 iOSHackerToday[3202:283287] * Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: '* -[NSArrayM
insertObject:atIndex:]: object cannot be nil'
*** First throw call stack: ( 0 CoreFoundation 0x0000000107842c65 __exceptionPreprocess + 165 1 libobjc.A.dylib
0x00000001074dbbb7 objc_exception_throw + 45 2 CoreFoundation
0x000000010770f8ca -[__NSArrayM insertObject:atIndex:] + 954 3
UIKit 0x0000000107d6f0b9
-[UIViewController _addChildViewController:performHierarchyCheck:notifyWillMove:] + 338 4 UIKit 0x0000000108241a0c
-[_UIViewServiceViewControllerOperator __createViewController:withContextToken:fbsDisplays:appearanceSerializedRepresentations:legacyAppearance:traitCollection:initialInterfaceOrientation:hostAccessibilityServerPort:canShowTextServices:replyHandler:]
+ 2216 5 CoreFoundation 0x0000000107738dec __invoking_ + 140 6 CoreFoundation 0x0000000107738c42 -[NSInvocation invoke] + 290 7 CoreFoundation
0x00000001077c9016 -[NSInvocation invokeWithTarget:] + 54 8 UIKit
0x00000001082fd01b -[_UIViewServiceImplicitAnimationDecodingProxy
forwardInvocation:] + 222 9 CoreFoundation
0x000000010779ff4f forwarding + 495 10 CoreFoundation
0x000000010779fcd8 _CF_forwarding_prep_0 + 120 11 CoreFoundation
0x0000000107738dec invoking_ + 140 12 CoreFoundation
0x0000000107738c42 -[NSInvocation invoke] + 290 13 CoreFoundation
0x00000001077c9016 -[NSInvocation invokeWithTarget:] + 54 14 UIKit
0x00000001082889f4 -[_UIQueueingProxy forwardInvocation:] + 319 15
CoreFoundation 0x000000010779ff4f
forwarding + 495 16 CoreFoundation 0x000000010779fcd8 _CF_forwarding_prep_0 + 120 17 CoreFoundation
0x0000000107738dec invoking_ + 140 18 CoreFoundation
0x0000000107738c42 -[NSInvocation invoke] + 290 19 CoreFoundation
0x00000001077c9016 -[NSInvocation invokeWithTarget:] + 54 20
CoreFoundation 0x000000010779ff4f
forwarding + 495 21 CoreFoundation 0x000000010779fcd8 _CF_forwarding_prep_0 + 120 22 CoreFoundation
0x0000000107738dec invoking_ + 140 23 CoreFoundation
0x0000000107738c42 -[NSInvocation invoke] + 290 24 libdispatch.dylib
0x0000000109da6f16 _dispatch_call_block_and_release + 12 25
libdispatch.dylib 0x0000000109dc1964
_dispatch_client_callout + 8 26 libdispatch.dylib 0x0000000109daca59 _dispatch_main_queue_callback_4CF + 704 27
CoreFoundation 0x00000001077aa1f9
CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 9 28 CoreFoundation 0x000000010776bdcb __CFRunLoopRun
+ 2043 29 CoreFoundation 0x000000010776b366 CFRunLoopRunSpecific + 470 30 GraphicsServices
0x000000010b01ca3e GSEventRunModal + 161 31 UIKit
0x0000000107c3b900 UIApplicationMain + 1282 32 libxpc.dylib
0x000000010a0a7aec _xpc_objc_main + 453 33 libxpc.dylib
0x000000010a0a9e91 xpc_main + 185 34 Foundation
0x0000000107209ee1 service_connection_handler + 0 35 PlugInKit
0x0000000106ff3a82 -[PKService run] + 521 36 PlugInKit
0x0000000106ff3747 +[PKService main] + 55 37 PlugInKit
0x0000000106ff3aa6 +[PKService _defaultRun:arguments:] + 17 38
libextension.dylib 0x000000010978399d NSExtensionMain
+ 51 39 libdyld.dylib 0x0000000109df1145 start + 1 40 ??? 0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught exception of type
NSException (lldb)
When you delete the default layout and drag a new table view controller, you need to mark the new view controller as 'Intial View Controller'
Here's the Apple's document which explains how to do it. https://developer.apple.com/library/ios/recipes/xcode_help-IB_storyboard/chapters/SetInitialController.html
In the storyboard, if you are using a custom view controller class made in swift, make sure you check the box 'Inherit Module From Target':

How to debug CoreFoundation Crash run_animation_callbacks

I do not know how I can use the following crash report from crashlytics to narrow down the source of the crash.
All I understand is that it has something to do with CoreFoundation, but what exactly is the crash? And where in my code is it happening?
Is a CAAnimation Delegate? Or perhaps I did not remove and observer from NSNotifications?
Any ideas?
Crashed: com.apple.main-thread SIGABRT ABORT at 0x39a5cdf0
Thread : Crashed: com.apple.main-thread
0 libsystem_kernel.dylib 0x39a5cdf0 __pthread_kill + 8
1 libsystem_pthread.dylib 0x39addc97 pthread_kill + 62
2 libsystem_c.dylib 0x399fb939 abort + 76
3 libc++abi.dylib 0x38bfabbd __cxa_bad_cast
4 libc++abi.dylib 0x38c1466f default_terminate_handler() + 266
5 libobjc.A.dylib 0x393eef11 _objc_terminate() + 192
6 libc++abi.dylib 0x38c11def std::__terminate(void (*)()) + 78
7 libc++abi.dylib 0x38c115b1 __cxxabiv1::exception_cleanup_func(_Unwind_Reason_Code, _Unwind_Exception*)
8 libobjc.A.dylib 0x393eed4b objc_exception_throw + 250
9 CoreFoundation 0x2b4975fd __methodDescriptionForSelector
10 CoreFoundation 0x2b4954d9 ___forwarding___ + 712
11 CoreFoundation 0x2b3c49d8 _CF_forwarding_prep_0 + 24
12 QuartzCore 0x2e4eeff3 CA::Layer::run_animation_callbacks(void*) + 150
13 libdispatch.dylib 0x39958c6f _dispatch_client_callout + 22
14 libdispatch.dylib 0x39964553 _dispatch_main_queue_callback_4CF$VARIANT$mp + 1322
15 CoreFoundation 0x2b457889 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
16 CoreFoundation 0x2b455fa9 __CFRunLoopRun + 1512
17 CoreFoundation 0x2b3a19a1 CFRunLoopRunSpecific + 476
18 CoreFoundation 0x2b3a17b3 CFRunLoopRunInMode + 106
19 GraphicsServices 0x32b531a9 GSEventRunModal + 136
20 UIKit 0x2eb2c695 UIApplicationMain + 1440

Objective-C - UIBarButtonItem Crashes, weird crash log

I have an UIBarButtonItem that is crashing, but I can't figure out what is happening. It's not generating any error on the debugger and its crash log is not symbolicating some parts. This is the crash log:
Last Exception Backtrace:
0 CoreFoundation 0x354ba88f __exceptionPreprocess + 163
1 libobjc.A.dylib 0x37861259 objc_exception_throw + 33
2 CoreFoundation 0x354ba789 +[NSException raise:format:] + 1
3 Foundation 0x34fa23ff -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 87
4 Exame_iPhone 0x000b9029 0x4b000 + 450601
5 Exame_iPhone 0x000b9071 0x4b000 + 450673
6 Exame_iPhone 0x0010a60d 0x4b000 + 783885
7 Exame_iPhone 0x0010aa7b 0x4b000 + 785019
8 Exame_iPhone 0x00069ff3 0x4b000 + 126963
9 CoreFoundation 0x354143fd -[NSObject performSelector:withObject:withObject:] + 53
10 UIKit 0x32f09e07 -[UIApplication sendAction:to:from:forEvent:] + 63
11 UIKit 0x32fcf5e7 -[UIBarButtonItem(UIInternal) _sendAction:withEvent:] + 119
12 CoreFoundation 0x354143fd -[NSObject performSelector:withObject:withObject:] + 53
13 UIKit 0x32f09e07 -[UIApplication sendAction:to:from:forEvent:] + 63
14 UIKit 0x32f09dc3 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 31
15 UIKit 0x32f09da1 -[UIControl sendAction:to:forEvent:] + 45
16 UIKit 0x32f09b11 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 493
17 UIKit 0x32f0a449 -[UIControl touchesEnded:withEvent:] + 477
18 UIKit 0x32f0892b -[UIWindow _sendTouchesForEvent:] + 319
19 UIKit 0x32f08319 -[UIWindow sendEvent:] + 381
20 UIKit 0x32eee695 -[UIApplication sendEvent:] + 357
21 UIKit 0x32eedf3b _UIApplicationHandleEvent + 5827
22 GraphicsServices 0x370ad22b PurpleEventCallback + 883
23 CoreFoundation 0x3548e523 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 39
24 CoreFoundation 0x3548e4c5 __CFRunLoopDoSource1 + 141
25 CoreFoundation 0x3548d313 __CFRunLoopRun + 1371
26 CoreFoundation 0x354104a5 CFRunLoopRunSpecific + 301
27 CoreFoundation 0x3541036d CFRunLoopRunInMode + 105
28 GraphicsServices 0x370ac439 GSEventRunModal + 137
29 UIKit 0x32f1ccd5 UIApplicationMain + 1081
30 Exame_iPhone 0x0004c23b 0x4b000 + 4667
31 Exame_iPhone 0x0004c1e0 0x4b000 + 4576
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x35d7032c __pthread_kill + 8
1 libsystem_c.dylib 0x328bc208 pthread_kill + 48
2 libsystem_c.dylib 0x328b5298 abort + 88
3 libc++abi.dylib 0x35872f64 abort_message + 40
4 libc++abi.dylib 0x35870346 _ZL17default_terminatev + 18
5 libobjc.A.dylib 0x37861350 _objc_terminate + 140
6 libc++abi.dylib 0x358703be _ZL19safe_handler_callerPFvvE + 70
7 libc++abi.dylib 0x3587044a std::terminate() + 14
8 libc++abi.dylib 0x3587181e __cxa_rethrow + 82
9 libobjc.A.dylib 0x378612a2 objc_exception_rethrow + 6
10 CoreFoundation 0x35410506 CFRunLoopRunSpecific + 398
11 CoreFoundation 0x35410366 CFRunLoopRunInMode + 98
12 GraphicsServices 0x370ac432 GSEventRunModal + 130
13 UIKit 0x32f1ccce UIApplicationMain + 1074
14 Exame_iPhone 0x0004c234 0x4b000 + 4660
15 Exame_iPhone 0x0004c1d8 0x4b000 + 4568
Does anybody know what is going on?
Regards!
An assertion fails in the non-symbolicated lines, probably in your own method. Set a breakpoint at the beginning of your button method and step through until you get the crash.

iOS App crash issue `[UIWindow warpPoint:]`

I found a weird crash issue in my app, and I can't got enough message from the crash report.
Here is the crash report:
-[TileLayer _isChargeEnabled]: unrecognized selector sent to instance 0x14aeadb0
(null)
(
0 CoreFoundation 0x376298a7 __exceptionPreprocess + 186
1 libobjc.A.dylib 0x3169e259 objc_exception_throw + 32
2 CoreFoundation 0x3762ca9b -[NSObject doesNotRecognizeSelector:] + 174
3 CoreFoundation 0x3762b915 ___forwarding___ + 300
4 CoreFoundation 0x37586650 _CF_forwarding_prep_0 + 48
5 UIKit 0x30775e43 -[UIWindow warpPoint:] + 686
6 UIKit 0x3075c1ff _UIApplicationHandleEvent + 2438
7 GraphicsServices 0x3777922b PurpleEventCallback + 882
8 CoreFoundation 0x375fd523 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 38
9 CoreFoundation 0x375fd4c5 __CFRunLoopDoSource1 + 140
10 CoreFoundation 0x375fc313 __CFRunLoopRun + 1370
11 CoreFoundation 0x3757f4a5 CFRunLoopRunSpecific + 300
12 CoreFoundation 0x3757f36d CFRunLoopRunInMode + 104
13 GraphicsServices 0x37778439 GSEventRunModal + 136
14 UIKit 0x3078bcd5 UIApplicationMain + 1080
15 Movie 0x00022eb3 _mh_execute_header + 7859
16 Movie 0x00022e40 _mh_execute_header + 7744
)
Well, it means you tried passing a message (a.k.a calling a method) _isChargeEnabled to an object of class TileLayer, but it is non-existent.
UPDATE
I did a quick google search and turns out _isChargeEnabled is private API of Apple. You could check this and this for more information.

when scrolling data in tableview its crashing

When i am moving the data from tableview cell by one its crashing ..
When my view did loaded my array count is 64
I assign this to number of row return [categorieArray count];
and cell configuration
cell.textLabel.text=[categorieArray objectAtIndex:indexPath.row];
return cell;
*** Call stack at first throw:
(
0 CoreFoundation 0x00f8fbe9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x010e45c2 objc_exception_throw + 47
2 CoreFoundation 0x00f916fb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x00f01366 ___forwarding___ + 966
4 CoreFoundation 0x00f00f22 _CF_forwarding_prep_0 + 50
5 Sigma-Aldrich 0x0000468d -[RootViewController tableView:cellForRowAtIndexPath:] + 237
6 UIKit 0x000977fa -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:withIndexPath:] + 634
7 UIKit 0x0008d77f -[UITableView(UITableViewInternal) _createPreparedCellForGlobalRow:] + 75
8 UIKit 0x000a2450 -[UITableView(_UITableViewPrivate) _updateVisibleCellsNow:] + 1561
9 UIKit 0x0009a538 -[UITableView layoutSubviews] + 242
10 QuartzCore 0x017f5451 -[CALayer layoutSublayers] + 181
11 QuartzCore 0x017f517c CALayerLayoutIfNeeded + 220
12 QuartzCore 0x017ee37c _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 310
13 QuartzCore 0x017ee0d0 _ZN2CA11Transaction6commitEv + 292
14 QuartzCore 0x0181e7d5 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 99
15 CoreFoundation 0x00f70fbb __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 27
16 CoreFoundation 0x00f060e7 __CFRunLoopDoObservers + 295
17 CoreFoundation 0x00ecebd7 __CFRunLoopRun + 1575
18 CoreFoundation 0x00ece240 CFRunLoopRunSpecific + 208
19 CoreFoundation 0x00ece161 CFRunLoopRunInMode + 97
20 GraphicsServices 0x01203268 GSEventRunModal + 217
21 GraphicsServices 0x0120332d GSEventRun + 115
22 UIKit 0x0003242e UIApplicationMain + 1160
23 Sigma-Aldrich 0x00001d49 main + 121
24 Sigma-Aldrich 0x00001cc5 start + 53
25 ??? 0x00000001 0x0 + 1
)
terminate called after throwing an instance of 'NSException'
It seems you have an incomplete implementation of your UITableViewDataSource, specifically (it seems) you forgot to implement tableView:cellForRowAtIndexPath, so that when the framework tries and calls it, it fails.
Have a look here for more info.