iOS App crash with exception related to _NSFastEnumerationMutationHandler - iphone

I am currently working on an iOS app which crashes and generates the crash report provided below.We think that the app is crashing due to mutation while Fast Enumeration but the error is occurring in NSISEngine.
We also think that the issue is related to constraints of a Table View. This Table View shows info fetched from Rest Services and we are programmatically updating the DataSource in viewWillAppear().
Some of the constraints we are adding programmatically which are as follows:
Method:
1.cellForRowAtIndexPath()
Constraints:
a. Updated UILabel with attributed String to set line height:
[attributedString addAttribute:NSFontAttributeName value:self.font range:NSMakeRange(0, text.length)];
self.attributedText = attributedString;
b. Updated UIImage:
myCell.myLogo.layer.masksToBounds =YES;
myCell.myLogo.layer.opaque = NO;
[[myCell.myLogo layer] setCornerRadius:4.];
c. Border for Table View cell
mySecondCell.secondCellContainerView.layer.masksToBounds = YES;
[mySecondCell.secondCellContainerView.layer setCornerRadius:3.7];
[mySecondCell.secondCellContainerView addBorderWithColorRed:#214 Green:#214 Blue:#214];
[myCell.myLogo addBorderWithColorRed:#214 Green:#214 Blue:#214];
heightForRowAtIndexPath()
Constraints:
We are calculating height on the basis of the content which is dynamic.
We are using StoryBoard and some of the constraints are set there using Auto Layout.
I searched a lot however was unable to find a crash report similar to the one my app generated. I am new to iOS programming. Can somebody help me with debugging this crash report? If there is a constraint causing this issue, can somebody help me figure out the same? Thanks in advance.
Incident Identifier: F155875B-9FD3-425F-85B9-7595617AF52A
CrashReporter Key: aaa79870161ff1e371394b881a26e97f0066f464
Hardware Model: iPhone5,2
Process: myapp [611]
Path: /var/mobile/Applications/40D6D77C-1DBB-4F6B-BEE1-73A67C789C49/myapp.app/myapp
Identifier: com.myapp
Version: 1.0 (0.9)
Code Type: ARM (Native)
Parent Process: launchd [1]
Date/Time: 2013-10-17 11:16:45.559 +0530
OS Version: iOS 7.0.2 (11A501)
Report Version: 104
Exception Type: EXC_CRASH (SIGTRAP)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Triggered by Thread: 0
Last Exception Backtrace:
0 CoreFoundation 0x2fc9fe86 __exceptionPreprocess + 126
1 libobjc.A.dylib 0x39f9a6c2 objc_exception_throw + 34
2 CoreFoundation 0x2fc9f974 __NSFastEnumerationMutationHandler + 124
3 Foundation 0x30604f32 -[NSISEngine substituteOutAllOccurencesOfBodyVar:withExpression:] + 438
4 Foundation 0x30607ba2 -[NSISEngine pivotToMakeBodyVar:newHeadOfRowWithHead:andDropRow:] + 334
5 Foundation 0x3060594c -[NSISEngine minimizeConstantInObjectiveRowWithHead:] + 232
6 Foundation 0x3060546e -[NSISEngine optimize] + 170
7 Foundation 0x306011a8 -[NSISEngine withBehaviors:performModifications:] + 312
8 UIKit 0x32424490 -[UIView(Hierarchy) _postMovedFromSuperview:] + 292
9 UIKit 0x3243114e -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1398
10 UIKit 0x32447a9c -[UIView(Hierarchy) insertSubview:atIndex:] + 32
11 UIKit 0x325fb888 -[UINavigationBar _wrapView:inClippingViewWithLeftBoundary:rightBoundary:leftMaskImage:leftMaskIsChevron:rightMaskImage:] + 240
12 UIKit 0x325b505e -[UINavigationBar _startPopAnimationFromItems:fromBarStyle:toItems:toBarStyle:] + 1982
13 UIKit 0x324f1b88 -[UINavigationBar popNavigationItem] + 1316
14 UIKit 0x324f14a0 -[UINavigationBar _popNavigationItemWithTransition:] + 556
15 UIKit 0x326f02ac ___popViewControllerNormal_block_invoke + 152
16 UIKit 0x324d43a0 -[UINavigationController _startDeferredTransitionIfNeeded:] + 868
17 UIKit 0x324d3fe4 -[UINavigationController __viewWillLayoutSubviews] + 40
18 UIKit 0x324d3f78 -[UILayoutContainerView layoutSubviews] + 180
19 UIKit 0x3242552e -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 342
20 QuartzCore 0x320acf3e -[CALayer layoutSublayers] + 138
21 QuartzCore 0x320a8762 CA::Layer::layout_if_needed(CA::Transaction*) + 346
22 QuartzCore 0x320a85f4 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 12
23 QuartzCore 0x320a8008 CA::Context::commit_transaction(CA::Transaction*) + 224
24 QuartzCore 0x320a7e1a CA::Transaction::commit() + 310
25 QuartzCore 0x320d5436 CA::Transaction::release_thread(void*) + 158
26 libsystem_pthread.dylib 0x3a5af9b0 _pthread_tsd_cleanup + 160
27 libsystem_pthread.dylib 0x3a5af732 _pthread_exit + 82
28 libsystem_pthread.dylib 0x3a5b04b8 pthread_exit + 24
29 Foundation 0x305d7ac6 +[NSThread exit] + 6
30 Foundation 0x30683de0 __NSThread__main__ + 1088
31 libsystem_pthread.dylib 0x3a5b0c58 _pthread_body + 136
32 libsystem_pthread.dylib 0x3a5b0bca _pthread_start + 98
33 libsystem_pthread.dylib 0x3a5aeccc thread_start + 4
Thread 0 Crashed:
0 libsystem_malloc.dylib 0x3a572596 szone_free_definite_size + 1510
1 UIFoundation 0x3754aab4 -[NSAttributeDictionaryEnumerator dealloc] + 68
2 libobjc.A.dylib 0x39fa5b06 objc_object::sidetable_release(bool) + 170
3 libobjc.A.dylib 0x39f9701e (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 354
4 QuartzCore 0x320a1b54 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 64
5 CoreFoundation 0x2fc6af6e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 18
6 CoreFoundation 0x2fc688fa __CFRunLoopDoObservers + 282
7 CoreFoundation 0x2fc68c46 __CFRunLoopRun + 734
8 CoreFoundation 0x2fbd353c CFRunLoopRunSpecific + 520
9 CoreFoundation 0x2fbd331e CFRunLoopRunInMode + 102
10 GraphicsServices 0x3490a2e6 GSEventRunModal + 134
11 UIKit 0x3248a1e0 UIApplicationMain + 1132
12 myapp 0x000aac16 main (main.mm:16)
13 libdyld.dylib 0x3a493ab4 start + 0
Thread 1:
0 libsystem_kernel.dylib 0x3a537838 kevent64 + 24
1 libdispatch.dylib 0x3a4860d0 _dispatch_mgr_invoke + 228
2 libdispatch.dylib 0x3a48063e _dispatch_mgr_thread + 34
Thread 2 name: com.apple.NSURLConnectionLoader
Thread 2:
0 libsystem_kernel.dylib 0x3a537a84 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x3a53787c mach_msg + 36
2 CoreFoundation 0x2fc6a55c __CFRunLoopServiceMachPort + 152
3 CoreFoundation 0x2fc68c7c __CFRunLoopRun + 788
4 CoreFoundation 0x2fbd353c CFRunLoopRunSpecific + 520
5 CoreFoundation 0x2fbd331e CFRunLoopRunInMode + 102
6 Foundation 0x3060e64c +[NSURLConnection(Loader) _resourceLoadLoop:] + 316
7 Foundation 0x30683dc2 __NSThread__main__ + 1058
8 libsystem_pthread.dylib 0x3a5b0c5a _pthread_body + 138
9 libsystem_pthread.dylib 0x3a5b0bca _pthread_start + 98
10 libsystem_pthread.dylib 0x3a5aeccc thread_start + 4
Thread 3 name: com.apple.CFSocket.private
Thread 3:
0 libsystem_kernel.dylib 0x3a54a440 select$DARWIN_EXTSN + 20
1 CoreFoundation 0x2fc6e45e __CFSocketManager + 482
2 libsystem_pthread.dylib 0x3a5b0c5a _pthread_body + 138
3 libsystem_pthread.dylib 0x3a5b0bca _pthread_start + 98
4 libsystem_pthread.dylib 0x3a5aeccc thread_start + 4
[12:37:06 PM] Devika Deshmukh: Thread 4:
0 libsystem_kernel.dylib 0x3a537a84 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x3a53787c mach_msg + 36
2 CoreFoundation 0x2fc6a55c __CFRunLoopServiceMachPort + 152
3 CoreFoundation 0x2fc68c7c __CFRunLoopRun + 788
4 CoreFoundation 0x2fbd353c CFRunLoopRunSpecific + 520
5 CoreFoundation 0x2fbd331e CFRunLoopRunInMode + 102
6 Foundation 0x305c1822 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 250
7 Foundation 0x30612664 -[NSRunLoop(NSRunLoop) run] + 76
8 myapp 0x00197bdc +[AFURLConnectionOperation networkRequestThreadEntryPoint:] (AFURLConnectionOperation.m:160)
9 Foundation 0x30683dc2 __NSThread__main__ + 1058
10 libsystem_pthread.dylib 0x3a5b0c5a _pthread_body + 138
11 libsystem_pthread.dylib 0x3a5b0bca _pthread_start + 98
12 libsystem_pthread.dylib 0x3a5aeccc thread_start + 4
Thread 5:
0 libsystem_c.dylib 0x3a4fb09e __abort + 102
1 libsystem_c.dylib 0x3a4fb034 abort + 84
2 myapp 0x001bd8ea ___lldb_unnamed_function5196$$myapp + 22
3 CoreFoundation 0x2fca018a __handleUncaughtException + 578
4 libobjc.A.dylib 0x39f9a924 _objc_terminate() + 172
5 libc++abi.dylib 0x399601b0 std::__terminate(void (*)()) + 76
6 libc++abi.dylib 0x3995fa04 __cxa_throw + 112
7 libobjc.A.dylib 0x39f9a796 objc_exception_throw + 246
8 CoreFoundation 0x2fc9f974 __NSFastEnumerationMutationHandler + 124
9 Foundation 0x30604f32 -[NSISEngine substituteOutAllOccurencesOfBodyVar:withExpression:] + 438
10 Foundation 0x30607ba2 -[NSISEngine pivotToMakeBodyVar:newHeadOfRowWithHead:andDropRow:] + 334
11 Foundation 0x3060594c -[NSISEngine minimizeConstantInObjectiveRowWithHead:] + 232
12 Foundation 0x3060546e -[NSISEngine optimize] + 170
13 Foundation 0x306011a8 -[NSISEngine withBehaviors:performModifications:] + 312
14 UIKit 0x32424490 -[UIView(Hierarchy) _postMovedFromSuperview:] + 292
15 UIKit 0x3243114e -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1398
16 UIKit 0x32447a9c -[UIView(Hierarchy) insertSubview:atIndex:] + 32
17 UIKit 0x325fb888 -[UINavigationBar _wrapView:inClippingViewWithLeftBoundary:rightBoundary:leftMaskImage:leftMaskIsChevron:rightMaskImage:] + 240
18 UIKit 0x325b505e -[UINavigationBar _startPopAnimationFromItems:fromBarStyle:toItems:toBarStyle:] + 1982
19 UIKit 0x324f1b88 -[UINavigationBar popNavigationItem] + 1316
20 UIKit 0x324f14a0 -[UINavigationBar _popNavigationItemWithTransition:] + 556
21 UIKit 0x326f02ac ___popViewControllerNormal_block_invoke + 152
22 UIKit 0x324d43a2 -[UINavigationController _startDeferredTransitionIfNeeded:] + 870
23 UIKit 0x324d3fe4 -[UINavigationController __viewWillLayoutSubviews] + 40
24 UIKit 0x324d3f78 -[UILayoutContainerView layoutSubviews] + 180
25 UIKit 0x3242552e -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 342
26 QuartzCore 0x320acf3e -[CALayer layoutSublayers] + 138
27 QuartzCore 0x320a8762 CA::Layer::layout_if_needed(CA::Transaction*) + 346
28 QuartzCore 0x320a85f4 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 12
29 QuartzCore 0x320a8008 CA::Context::commit_transaction(CA::Transaction*) + 224
30 QuartzCore 0x320a7e1a CA::Transaction::commit() + 310
31 QuartzCore 0x320d5436 CA::Transaction::release_thread(void*) + 158
32 libsystem_pthread.dylib 0x3a5af9b2 _pthread_tsd_cleanup + 162
33 libsystem_pthread.dylib 0x3a5af732 _pthread_exit + 82
34 libsystem_pthread.dylib 0x3a5b04b8 pthread_exit + 24
35 Foundation 0x305d7ac6 +[NSThread exit] + 6
36 Foundation 0x30683de0 __NSThread__main__ + 1088
37 libsystem_pthread.dylib 0x3a5b0c5a _pthread_body + 138
38 libsystem_pthread.dylib 0x3a5b0bca _pthread_start + 98
39 libsystem_pthread.dylib 0x3a5aeccc thread_start + 4
Thread 6:
0 libsystem_kernel.dylib 0x3a54ac7c __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x3a5aee06 _pthread_wqthread + 306
2 libsystem_pthread.dylib 0x3a5aecc0 start_wqthread + 4
Thread 0 crashed with ARM Thread State (32-bit):
r0: 0x00280a00 r1: 0xfffff000 r2: 0x17f9a000 r3: 0x0000000c
r4: 0x17f99650 r5: 0x3c32fe08 r6: 0x3c32fe00 r7: 0x27d5cb50
r8: 0x00000001 r9: 0x00000fff r10: 0x17f99650 r11: 0x0000008a
ip: 0x17f99db0 sp: 0x27d5cb4c lr: 0x39f96e39 pc: 0x3a572596
cpsr: 0x20000030
Update:
Following is the code by which we are populating our datasource:
(void) viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
viewWillAppearFlag = true;
if(dataFetched) {
[self setupDatasourceDetails:self.myData];
}
}
(void) setupDatasourceDetails:(NSArray *)data {
self.datasource = [MyDatasource new];
self.datasource.data=data;
[self.myTable setDataSource:self.datasource];
[self.myTable setDelegate:self.datasource];
[self.myTable reloadData];
}
//Callback from REST services
(void) onDataFetched:(NSArray *)data{
dataFetched=true;
self.myData=data;
if(viewWillAppearFlag){
[self setupDatasourceDetails:self.myData]; //the event which will occur later(either viewWillAppear or dataFetched) calls setupDatasourceDetails
}
}
Update:
The error is occurring while transition back from one view controller to another (in navigation controller).
We are using [self.navigationController popViewControllerAnimated:YES]; to transition back to the previous view controller. The transition is happening on the Main thread.
Let us know if any more information is required.
Update
It seems that our problem has been resolved. We moved the functionality from viewWillAppear to viewDidAppear. This fix seems to have resolved the issue. Does anyone know the reason why this fix worked? Please let us know. Thanks.

Two suggestions:
Check that self.datasource is defined as strong property (not
weak) (and the data property on MyDatasource)
Make sure
onDataFetched:is called on the main queue. If unsure, use this
dispatching mechanism instead:
dispatch_async(dispatch_get_main_queue(), ^{
// all update code here
});

I don't think the error is directly in the code you posted, but:
NSFastEnumerationMutationHandler
is raised when you are editing an array or dictionary while enumerating it.
For example this is wrong:
for ( id obj in anArray ) {
if ( [obj shouldRemove == YES ) {
[anArray removeObject:obj];
}
}
If you need to do that you should work with a copy of an array or use filteredArrayUsingPredicate.

Can't see all of your code, but I am thinking you need to call layoutIfNeeded before setting the constraints as the views are not calculated before ViewWillAppear. The fact that it succeeds in ViewDidAppear is because the elements have been calculated. Alternately, you could try your code in DidLayoutSubviews.

Related

Unable to understand Apple Crash Log with -[UIApplication _cachedSystemAnimationFenceCreatingIfNecessary:]

I'm unable to understand this crash log from Apple. I have been a few times rejected because of this. They are complaining it's occurred on ipad running latest software 10.3.1. When we double check with on ipad simulator, it's running without crashes.
Last Exception Backtrace:
0 CoreFoundation 0x1848b2fd8 __exceptionPreprocess + 124
1 libobjc.A.dylib 0x183314538 objc_exception_throw + 56
2 CoreFoundation 0x1848b2eac +[NSException raise:format:arguments:] + 104
3 Foundation 0x18534a710 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 112
4 UIKit 0x18ac57454 -[UIApplication _cachedSystemAnimationFenceCreatingIfNecessary:] + 196
5 UIKit 0x18ac57514 -[UIApplication _systemAnimationFenceCreatingIfNecessary:] + 24
6 UIKit 0x18acb07a0 +[UIWindow _synchronizedDrawingFence] + 116
7 UIKit 0x18ae6e150 +[_UIKeyboardChangedInformation informationForKeyboardUp:withIAV:] + 104
8 UIKit 0x18b1678d4 -[_UIRemoteKeyboards prepareToMoveKeyboard:withIAV:showing:forScreen:] + 464
9 UIKit 0x18aa9fc04 -[UIPeripheralHost(UIKitInternal) setInputViews:animationStyle:] + 820
10 UIKit 0x18aabccf4 -[UIPeripheralHost(UIKitInternal) _restoreInputViewsWithId:animated:] + 584
11 UIKit 0x18ad4fd64 -[UIViewController _restoreInputViewsForPresentation] + 280
12 UIKit 0x18ad2ae3c -[UIPresentationController runTransitionForCurrentState] + 1560
13 UIKit 0x18ad290f8 -[UIPresentationController _dismissWithAnimationController:interactionController:target:didEndSelector:] + 764
14 UIKit 0x18ad4f8c0 -[UIViewController _dismissViewControllerWithAnimationController:interactionController:completion:] + 464
15 UIKit 0x18ab04cd4 -[UIViewController _dismissViewControllerWithTransition:from:completion:] + 600
16 UIKit 0x18aaacb6c -[UIViewController dismissViewControllerWithTransition:completion:] + 1144
17 UIKit 0x18aaac94c -[UIViewController dismissViewControllerWithTransition:completion:] + 600
18 UIKit 0x18ad4eb68 -[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 524
19 UIKit 0x18aaac6c0 -[UIViewController dismissViewControllerAnimated:completion:] + 152
20 newapp 0x100115628 0x1000b0000 + 415272
21 newapp 0x1001159e8 0x1000b0000 + 416232
22 CFNetwork 0x184ebc1fc __75-[__NSURLSessionLocal taskForClass:request:uploadFile:bodyData:completion:]_block_invoke + 32
23 CFNetwork 0x184ed3ef8 __49-[__NSCFLocalSessionTask _task_onqueue_didFinish]_block_invoke + 148
24 Foundation 0x185381804 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 16
25 Foundation 0x1852c6760 -[NSBlockOperation main] + 96
26 Foundation 0x1852b6b18 -[__NSOperationInternal _start:] + 612
27 Foundation 0x185383ba0 __NSOQSchedule_f + 228
28 libdispatch.dylib 0x18376a9a0 _dispatch_client_callout + 16
29 libdispatch.dylib 0x183778ad4 _dispatch_queue_serial_drain + 928
30 libdispatch.dylib 0x18376e2cc _dispatch_queue_invoke + 884
31 libdispatch.dylib 0x18377aa50 _dispatch_root_queue_drain + 540
32 libdispatch.dylib 0x18377a7d0 _dispatch_worker_thread3 + 124
33 libsystem_pthread.dylib 0x1839731d0 _pthread_wqthread + 1096
34 libsystem_pthread.dylib 0x183972d7c start_wqthread + 4
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0:
0 libsystem_kernel.dylib 0x000000018388f224 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x000000018388f09c mach_msg + 72
2 CoreFoundation 0x0000000184860e88 __CFRunLoopServiceMachPort + 192
3 CoreFoundation 0x000000018485eadc __CFRunLoopRun + 1060
4 CoreFoundation 0x000000018478ed94 CFRunLoopRunSpecific + 424
5 GraphicsServices 0x00000001861f8074 GSEventRunModal + 100
6 UIKit 0x000000018aa40130 UIApplicationMain + 208
7 newapp 0x000000010022f390 0x1000b0000 + 1569680
8 libdyld.dylib 0x000000018379d59c start + 4
Thread 1 name: com.apple.uikit.eventfetch-thread
Thread 1:
0 libsystem_kernel.dylib 0x000000018388f224 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x000000018388f09c mach_msg + 72
2 CoreFoundation 0x0000000184860e88 __CFRunLoopServiceMachPort + 192
3 CoreFoundation 0x000000018485eadc __CFRunLoopRun + 1060
4 CoreFoundation 0x000000018478ed94 CFRunLoopRunSpecific + 424
5 Foundation 0x00000001852a8d64 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304
6 Foundation 0x00000001852c9b34 -[NSRunLoop(NSRunLoop) runUntilDate:] + 96
7 UIKit 0x000000018b3ca5f8 -[UIEventFetcher threadMain] + 136
8 Foundation 0x00000001853a62c8 __NSThread__start__ + 996
9 libsystem_pthread.dylib 0x000000018397575c _pthread_body + 240
10 libsystem_pthread.dylib 0x000000018397566c _pthread_body + 0
11 libsystem_pthread.dylib 0x0000000183972d84 thread_start + 4
Thread 2:
0 libsystem_kernel.dylib 0x00000001838ada88 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x0000000183973274 _pthread_wqthread + 1260
2 libsystem_pthread.dylib 0x0000000183972d7c start_wqthread + 4
Thread 3 name: com.apple.CFStream.LegacyThread
Thread 3:
0 libsystem_kernel.dylib 0x000000018388f224 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x000000018388f09c mach_msg + 72
2 CoreFoundation 0x0000000184860e88 __CFRunLoopServiceMachPort + 192
3 CoreFoundation 0x000000018485eadc __CFRunLoopRun + 1060
4 CoreFoundation 0x000000018478ed94 CFRunLoopRunSpecific + 424
5 CoreFoundation 0x000000018486e78c _legacyStreamRunLoop_workThread + 268
6 libsystem_pthread.dylib 0x000000018397575c _pthread_body + 240
7 libsystem_pthread.dylib 0x000000018397566c _pthread_body + 0
8 libsystem_pthread.dylib 0x0000000183972d84 thread_start + 4
Thread 4 name: com.apple.NSURLConnectionLoader
Thread 4:
0 libsystem_kernel.dylib 0x000000018388f224 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x000000018388f09c mach_msg + 72
2 CoreFoundation 0x0000000184860e88 __CFRunLoopServiceMachPort + 192
3 CoreFoundation 0x000000018485eadc __CFRunLoopRun + 1060
4 CoreFoundation 0x000000018478ed94 CFRunLoopRunSpecific + 424
5 CFNetwork 0x0000000184f9aca4 +[NSURLConnection(Loader) _resourceLoadLoop:] + 404
6 Foundation 0x00000001853a62c8 __NSThread__start__ + 996
7 libsystem_pthread.dylib 0x000000018397575c _pthread_body + 240
8 libsystem_pthread.dylib 0x000000018397566c _pthread_body + 0
9 libsystem_pthread.dylib 0x0000000183972d84 thread_start + 4
Thread 5 name: Dispatch queue: NSOperationQueue 0x170031360 :: NSOperation 0x17024ab30 (QOS: DEFAULT)
Thread 5 Crashed:
0 libsystem_kernel.dylib 0x00000001838ad014 __pthread_kill + 8
1 libsystem_pthread.dylib 0x0000000183977334 pthread_kill + 112
2 libsystem_c.dylib 0x00000001838219c4 abort + 140
3 libc++abi.dylib 0x00000001832ed1b0 __cxa_bad_cast + 0
4 libc++abi.dylib 0x0000000183306c04 default_unexpected_handler() + 0
5 libobjc.A.dylib 0x0000000183314820 _objc_terminate() + 124
6 libc++abi.dylib 0x00000001833035d4 std::__terminate(void (*)()) + 16
7 libc++abi.dylib 0x0000000183303640 std::terminate() + 60
8 libdispatch.dylib 0x000000018376a9b4 _dispatch_client_callout + 36
9 libdispatch.dylib 0x0000000183778ad4 _dispatch_queue_serial_drain + 928
10 libdispatch.dylib 0x000000018376e2cc _dispatch_queue_invoke + 884
11 libdispatch.dylib 0x000000018377aa50 _dispatch_root_queue_drain + 540
12 libdispatch.dylib 0x000000018377a7d0 _dispatch_worker_thread3 + 124
13 libsystem_pthread.dylib 0x00000001839731d0 _pthread_wqthread + 1096
14 libsystem_pthread.dylib 0x0000000183972d7c start_wqthread + 4
The log clearly shows the problem happens on a background thread. You need to perform UI actions on the main queue. Use DispatchQueue.main.async to dismiss the view controller.

Xcode App crash only on device - EXC_CRASH (SIGABRT)

My app crashes only when I try to run it on my Iphone but doesn't on the simulator, I don't understand how to read a crash log could somebody give me a hint? In Xcode the app crashes at class AppDelegate: UIResponder, UIApplicationDelegate { with the signal SIGABRT
Incident Identifier: 8FF053DB-175C-40E8-9D9C-BD7B357BE6D4
CrashReporter Key: dc449591e2b211cdba4d3655b320f72f9d475cc7
Hardware Model: iPhone3,1
Process: com.zeghetusa.hungrybird [17612]
Path: /var/mobile/Applications/72EBA21E-94CB-4840-9A82-9B5B161C06ED/com.zeghetusa.hungrybird.app/com.zeghetusa.hungrybird
Identifier: com.zeghetusa.hungrybird
Version: 1 (1.0)
Code Type: ARM (Native)
Parent Process: debugserver [17611]
Date/Time: 2015-04-08 17:49:07.247 -0400
OS Version: iOS 7.1 (11D169)
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Triggered by Thread: 0
Last Exception Backtrace:
0 CoreFoundation 0x30a37fce __exceptionPreprocess + 126
1 libobjc.A.dylib 0x3b1e4cca objc_exception_throw + 34
2 CoreFoundation 0x30a3b86e +[NSObject(NSObject) doesNotRecognizeSelector:] + 198
3 CoreFoundation 0x30a3a24e ___forwarding___ + 702
4 CoreFoundation 0x309897f4 _CF_forwarding_prep_0 + 20
5 com.zeghetusa.hungrybird 0x000f8d48 0xb7000 + 269640
6 com.zeghetusa.hungrybird 0x000ebfe0 0xb7000 + 217056
7 com.zeghetusa.hungrybird 0x000efea8 0xb7000 + 233128
8 com.zeghetusa.hungrybird 0x000fb404 0xb7000 + 279556
9 com.zeghetusa.hungrybird 0x000fb94c 0xb7000 + 280908
10 UIKit 0x332584c6 -[UIViewController loadViewIfRequired] + 514
11 UIKit 0x33258284 -[UIViewController view] + 20
12 UIKit 0x33377b1e -[UIWindow handleStatusBarChangeFromHeight:toHeight:] + 698
13 UIKit 0x332ded2a +[UIWindow _noteStatusBarHeightChanged:oldHeight:forAutolayoutRootViewsOnly:] + 234
14 UIKit 0x333df2ca __79-[UIApplication _setStatusBarHidden:animationParameters:changeApplicationFlag:]_block_invoke + 126
15 UIKit 0x332893c0 +[UIView(UIViewAnimationWithBlocks) _setupAnimationWithDuration:delay:view:options:factory:animations:start:animationStateGenerator:completion:] + 492
16 UIKit 0x333c1ab2 +[UIView(UIViewAnimationWithBlocks) animateWithDuration:animations:completion:] + 66
17 UIKit 0x333046bc -[UIApplication _setStatusBarHidden:animationParameters:changeApplicationFlag:] + 460
18 UIKit 0x3325f348 -[UIApplication _updateCurrentStatusBarViewControllerAppearance] + 244
19 UIKit 0x3325c7fc -[UIWindow _setHidden:forced:] + 228
20 UIKit 0x332c6358 -[UIWindow makeKeyAndVisible] + 56
21 UIKit 0x332c2fc8 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1816
22 UIKit 0x332bd586 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 710
23 UIKit 0x33259704 -[UIApplication handleEvent:withNewEvent:] + 3536
24 UIKit 0x3325886c -[UIApplication sendEvent:] + 68
25 UIKit 0x332bccc4 _UIApplicationHandleEvent + 612
26 GraphicsServices 0x35871ae8 _PurpleEventCallback + 604
27 GraphicsServices 0x358716d2 PurpleEventCallback + 30
28 CoreFoundation 0x30a02ab2 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 30
29 CoreFoundation 0x30a02a4e __CFRunLoopDoSource1 + 342
30 CoreFoundation 0x30a01222 __CFRunLoopRun + 1394
31 CoreFoundation 0x3096bf4a CFRunLoopRunSpecific + 518
32 CoreFoundation 0x3096bd2e CFRunLoopRunInMode + 102
33 UIKit 0x332bbeec -[UIApplication _run] + 756
34 UIKit 0x332b7168 UIApplicationMain + 1132
35 com.zeghetusa.hungrybird 0x000fd164 0xb7000 + 287076
36 com.zeghetusa.hungrybird 0x000fd1a0 0xb7000 + 287136
37 libdyld.dylib 0x3b6f1ab2 tlv_initializer + 2
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x3b7a71f0 __pthread_kill + 8
1 libsystem_pthread.dylib 0x3b811792 pthread_kill + 54
2 libsystem_c.dylib 0x3b757fd8 abort + 72
3 libc++abi.dylib 0x3aa86cd2 abort_message + 70
4 libc++abi.dylib 0x3aa9f6e0 default_terminate_handler() + 248
5 libobjc.A.dylib 0x3b1e4f62 _objc_terminate() + 190
6 libc++abi.dylib 0x3aa9d1c4 std::__terminate(void (*)()) + 76
7 libc++abi.dylib 0x3aa9cd28 __cxa_rethrow + 96
8 libobjc.A.dylib 0x3b1e4e12 objc_exception_rethrow + 38
9 CoreFoundation 0x3096bfc0 CFRunLoopRunSpecific + 636
10 CoreFoundation 0x3096bd2e CFRunLoopRunInMode + 102
11 UIKit 0x332bbeec -[UIApplication _run] + 756
12 UIKit 0x332b7168 UIApplicationMain + 1132
13 com.zeghetusa.hungrybird 0x000fd164 0xb7000 + 287076
14 com.zeghetusa.hungrybird 0x000fd1a0 0xb7000 + 287136
15 libdyld.dylib 0x3b6f1ab4 start + 0
Thread 1:
0 libsystem_kernel.dylib 0x3b7a7c70 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x3b80ebda _pthread_wqthread + 306
2 libsystem_pthread.dylib 0x3b80ea94 start_wqthread + 4
Thread 2:
0 libsystem_kernel.dylib 0x3b7a7c70 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x3b80ebda _pthread_wqthread + 306
2 libsystem_pthread.dylib 0x3b80ea94 start_wqthread + 4
Thread 3 name: gputools.smt_poll.0x14d341b0
Thread 3:
0 libsystem_kernel.dylib 0x3b7a7544 __semwait_signal + 24
1 libsystem_c.dylib 0x3b718988 nanosleep + 168
2 libsystem_c.dylib 0x3b7188d6 usleep + 46
3 GPUToolsCore 0x0077af34 0x777000 + 16180
4 libsystem_pthread.dylib 0x3b810916 _pthread_body + 138
5 libsystem_pthread.dylib 0x3b810886 _pthread_start + 98
6 libsystem_pthread.dylib 0x3b80eaa0 thread_start + 4
Thread 4:
0 libsystem_kernel.dylib 0x3b7a7c70 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x3b80ebda _pthread_wqthread + 306
2 libsystem_pthread.dylib 0x3b80ea94 start_wqthread + 4
Thread 5:
0 libsystem_kernel.dylib 0x3b794808 kevent64 + 24
1 libdispatch.dylib 0x3b6e0de8 _dispatch_mgr_invoke + 228
2 libdispatch.dylib 0x3b6cff6e _dispatch_mgr_thread$VARIANT$up + 34
Thread 0 crashed with ARM Thread State (32-bit):
r0: 0x00000000 r1: 0x00000000 r2: 0x00000000 r3: 0x00002060
r4: 0x00000006 r5: 0x3d51018c r6: 0x00000000 r7: 0x27d4c474
r8: 0x14d93610 r9: 0x00000001 r10: 0x00101dd3 r11: 0x00000000
ip: 0x00000148 sp: 0x27d4c468 lr: 0x3b811797 pc: 0x3b7a71f0
cpsr: 0x00000010
Binary Images:
turns out my error was "Specifically init(fileNamed:) its only Available in iOS 8.0 and later."

iOS Xcode App crashes after release to App Store but not when testing

I've had an app on the app store for about a month and then I recently uploaded an updated binary to the App Store, version 2.0. It uses SpriteKit and ever since that update every person who downloaded it got a crash upon startup (this was apparent in the customer reviews). So I went back through my code and realized that I forgot to change one of the code signing options to Distribution instead of developer. After archiving that new binary, 2.1, and waiting ANOTHER week to have it released again, version 2.1 crashed as well. My app has been down for 2 weeks now and I'm fed up with this. I made very minor changes including a line of code in the AppDelegate.m that allows the user to play their own music in the background:
(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient error:nil];
return YES;
}
I am not super comfortable with Xcode and it is my first app. I get this crash report in iTunes Connect:
Incident Identifier: A0DB04E6-A62B-46AB-8896-CE77A91064EF
Hardware Model: iPhone5,3
Process: PokeJump [831]
Path: /var/mobile/Applications/BB765A31-6028-429B-9939- F69DB8B62E85/PokeJump.app/PokeJump
Identifier: PokeJump.PokeJump
Version: 2.0 (2.0)
Code Type: ARM (Native)
Parent Process: launchd [1]
Date/Time: 2014-07-01 19:07:36.341 -0400
OS Version: iOS 7.1.1 (11D201)
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Triggered by Thread: 0
Last Exception Backtrace:
0 CoreFoundation 0x2fe61f06 __exceptionPreprocess + 126
1 libobjc.A.dylib 0x3a5f8ce2 objc_exception_throw + 34
2 CoreFoundation 0x2fe61e48 +[NSException raise:format:] + 108
3 SpriteKit 0x325a6c12 +[SKPlaySound playSoundFileNamed:atPosition:waitForCompletion:] + 578
4 SpriteKit 0x3255f8ec +[SKAction(SKActions) playSoundFileNamed:waitForCompletion:] + 60
5 PokeJump 0x000637de 0x0005a000 + 38878
6 PokeJump 0x0006177e 0x0005a000 + 30590
7 PokeJump 0x0006e080 0x0005a000 + 82048
8 UIKit 0x32695a4e -[UIViewController loadViewIfRequired] + 514
9 UIKit 0x3269580c -[UIViewController view] + 20
10 UIKit 0x327b5292 -[UIWindow handleStatusBarChangeFromHeight:toHeight:] + 690
11 UIKit 0x3271c432 +[UIWindow _noteStatusBarHeightChanged:oldHeight:forAutolayoutRootViewsOnly:] + 234
12 UIKit 0x3281cb2c __79-[UIApplication _setStatusBarHidden:animationParameters:changeApplicationFlag:]_block_invoke + 128
13 UIKit 0x326c6a36 +[UIView(UIViewAnimationWithBlocks) _setupAnimationWithDuration:delay:view:options:factory:animations:start:animationStateGenerator:completion:] + 486
14 UIKit 0x327ff33a +[UIView(UIViewAnimationWithBlocks) animateWithDuration:animations:completion:] + 66
15 UIKit 0x32741de6 -[UIApplication _setStatusBarHidden:animationParameters:changeApplicationFlag:] + 458
16 UIKit 0x3269c8fc -[UIApplication _updateCurrentStatusBarViewControllerAppearance] + 244
17 UIKit 0x32699d8e -[UIWindow _setHidden:forced:] + 230
18 UIKit 0x32703a4c -[UIWindow makeKeyAndVisible] + 56
19 UIKit 0x327006e0 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1816
20 UIKit 0x326facc4 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 716
21 UIKit 0x32696c92 -[UIApplication handleEvent:withNewEvent:] + 3546
22 UIKit 0x32695df4 -[UIApplication sendEvent:] + 68
23 UIKit 0x326fa400 _UIApplicationHandleEvent + 612
24 GraphicsServices 0x34d03b50 _PurpleEventCallback + 604
25 GraphicsServices 0x34d0373a PurpleEventCallback + 30
26 CoreFoundation 0x2fe2c842 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 30
27 CoreFoundation 0x2fe2c7de __CFRunLoopDoSource1 + 342
28 CoreFoundation 0x2fe2afaa __CFRunLoopRun + 1402
29 CoreFoundation 0x2fd95764 CFRunLoopRunSpecific + 520
30 CoreFoundation 0x2fd95546 CFRunLoopRunInMode + 102
31 UIKit 0x326f9626 -[UIApplication _run] + 758
32 UIKit 0x326f488c UIApplicationMain + 1132
33 PokeJump 0x0006e73e 0x0005a000 + 83774
34 libdyld.dylib 0x3aaf6ab2 tlv_initializer + 2
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x3abad1f0 __pthread_kill + 8
1 libsystem_pthread.dylib 0x3ac157b2 pthread_kill + 54
2 libsystem_c.dylib 0x3ab5dff4 abort + 72
3 libc++abi.dylib 0x39fac98a abort_message + 70
4 libc++abi.dylib 0x39fc56e2 default_terminate_handler() + 250
5 libobjc.A.dylib 0x3a5f8f7a _objc_terminate() + 190
6 libc++abi.dylib 0x39fc31b0 std::__terminate(void
7 libc++abi.dylib 0x39fc2d12 __cxa_rethrow + 98
8 libobjc.A.dylib 0x3a5f8e2a objc_exception_rethrow + 38
9 CoreFoundation 0x2fd957da CFRunLoopRunSpecific + 638
10 CoreFoundation 0x2fd95546 CFRunLoopRunInMode + 102
11 UIKit 0x326f9626 -[UIApplication _run] + 758
12 UIKit 0x326f488c UIApplicationMain + 1132
13 PokeJump 0x0006e73e 0x5a000 + 83774
14 libdyld.dylib 0x3aaf6ab4 start + 0
Thread 1:
0 libsystem_kernel.dylib 0x3ab9a804 kevent64 + 24
1 libdispatch.dylib 0x3aae9050 _dispatch_mgr_invoke + 228
2 libdispatch.dylib 0x3aae32de _dispatch_mgr_thread + 34
Thread 2:
0 libsystem_kernel.dylib 0x3abadc70 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x3ac12c1e _pthread_wqthread + 306
2 libsystem_pthread.dylib 0x3ac12ad8 start_wqthread + 4
Thread 3:
0 libsystem_kernel.dylib 0x3abadc70 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x3ac12c1e _pthread_wqthread + 306
2 libsystem_pthread.dylib 0x3ac12ad8 start_wqthread + 4
Thread 4:
0 libsystem_kernel.dylib 0x3ab9aa50 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x3ab9a848 mach_msg + 36
2 CoreFoundation 0x2fe2c624 __CFRunLoopServiceMachPort + 152
3 CoreFoundation 0x2fe2ad44 __CFRunLoopRun + 788
4 CoreFoundation 0x2fd95764 CFRunLoopRunSpecific + 520
5 CoreFoundation 0x2fd95546 CFRunLoopRunInMode + 102
6 libAVFAudio.dylib 0x2edfa45e GenericRunLoopThread::Entry(void*) + 126
7 libAVFAudio.dylib 0x2edee8fc CAPThread::Entry(CAPThread*) + 176
8 libsystem_pthread.dylib 0x3ac14956 _pthread_body + 138
9 libsystem_pthread.dylib 0x3ac148c6 _pthread_start + 98
10 libsystem_pthread.dylib 0x3ac12ae4 thread_start + 4
Thread 5:
0 AudioToolbox 0x2f74f7d4 CrashIfClientProvidedBogusAudioBufferList + 124
1 AudioToolbox 0x2f75e1d6 AudioConverterFillComplexBuffer + 250
2 AudioToolbox 0x2f81decc AUInputFormatConverter2::PullAndConvertInput(AudioTimeStamp const&, unsigned long&, AudioBufferList&, AudioStreamPacketDescription*, bool&) + 96
3 AudioToolbox 0x2f81da74 AUConverterBase::RenderBus(unsigned long&, AudioTimeStamp const&, unsigned long, unsigned long) + 212
4 AudioToolbox 0x2f7518f4 AUBase::DoRenderBus(unsigned long&, AudioTimeStamp const&, unsigned long, AUOutputElement*, unsigned long, AudioBufferList&) + 144
5 AudioToolbox 0x2f751744 AUBase::DoRender(unsigned long&, AudioTimeStamp const&, unsigned long, unsigned long, AudioBufferList&) + 528
6 AudioToolbox 0x2f80d96c AURemoteIO::PerformIO(unsigned long, unsigned int, unsigned int, AudioTimeStamp const&, AudioTimeStamp const&, AudioBufferList const*, AudioBufferList*, int&) + 484
7 AudioToolbox 0x2f80e9b8 AURIOCallbackReceiver_PerformIO + 392
8 AudioToolbox 0x2f8050b2 _XPerformIO + 174
9 AudioToolbox 0x2f77264a mshMIGPerform + 122
10 AudioToolbox 0x2f7e1b28 MSHMIGDispatchMessage + 28
11 AudioToolbox 0x2f80dbe4 AURemoteIO::IOThread::Run() + 116
12 AudioToolbox 0x2f810cc4 AURemoteIO::IOThread::Entry(void*) + 4
13 AudioToolbox 0x2f74db38 CAPThread::Entry(CAPThread*) + 208
14 libsystem_pthread.dylib 0x3ac14956 _pthread_body + 138
15 libsystem_pthread.dylib 0x3ac148c6 _pthread_start + 98
16 libsystem_pthread.dylib 0x3ac12ae4 thread_start + 4
Thread 0 crashed with ARM Thread State (32-bit):
I realize it says version 2.0 on this crash report but I am assuming both crashed for the same reason. I am desperate to find a fix for this and it frustrates me so much because it runs perfectly fine on all the simulators and on my iPad and iPhone when I run it when connected to my computer. Any help would mean a lot. Thanks

App Crash, no idea why

I trying to figure out why my App crashes sometimes on costumers devices. It doesnt matter if the device is jailbreaked or not. My App is from the AppStore. The other crashlogs are nearly the same although their crashed threads are different.
Hardware Model: iPhone3,1
Process: [the APP] [296]
Path: /var/mobile/Applications/06DF5BC5-F9C2-49EE-B2D5-5979C09B51A2/[the APP].app/[the APP]
Identifier: [the APP]
Version: 3.3.0
Code Type: ARM
Parent Process: launchd [1]
Date/Time: 2012-07-22 15:15:18 +0000
OS Version: iPhone OS 5.1.1 (9B206)
Report Version: 104
Exception Type: SIGSEGV
Exception Codes: SEGV_ACCERR at 0xbbadbeef
Crashed Thread: 7
Thread 0:
0 libsystem_kernel.dylib 0x35c39004 mach_msg_trap + 20
1 CoreFoundation 0x353673f3 __CFRunLoopServiceMachPort + 127
2 CoreFoundation 0x353660f1 __CFRunLoopRun + 825
3 CoreFoundation 0x352e94a5 CFRunLoopRunSpecific + 301
4 CoreFoundation 0x352e936d CFRunLoopRunInMode + 105
5 GraphicsServices 0x36f85439 GSEventRunModal + 137
6 UIKit 0x32df5cd5 UIApplicationMain + 1081
7 [the APP] 0x0000b549 main (main.m:20)
Thread 1:
0 libsystem_kernel.dylib 0x35c393a8 kevent + 24
1 libdispatch.dylib 0x3422cbc9 _dispatch_mgr_wakeup + 1
Thread 2:
0 libsystem_kernel.dylib 0x35c490d8 __psynch_mutexwait + 24
1 WebCore 0x311454ef _ZL17_WebTryThreadLockb + 215
2 WebCore 0x311a4173 _ZL19SendDelegateMessageP12NSInvocation + 707
3 WebKit 0x3507ad87 -[_WebSafeForwarder forwardInvocation:] + 119
4 CoreFoundation 0x35395a83 ___forwarding___ + 667
5 CoreFoundation 0x352f0650 _CF_forwarding_prep_0 + 48
6 WebKit 0x350816a1 WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction(void (WebCore::PolicyChecker::*)(WebCore::PolicyAction), WebCore::NavigationAction const&, WebCore::ResourceRequest const&, WTF::PassRefPtr) + 221
7 WebCore 0x3120b8b9 WebCore::PolicyChecker::checkNavigationPolicy(WebCore::ResourceRequest const&, WebCore::DocumentLoader*, WTF::PassRefPtr, void (*)(void*, WebCore::ResourceRequest const&, WTF::PassRefPtr, bool), void*) + 873
8 WebCore 0x3120ae4d WebCore::FrameLoader::loadWithDocumentLoader(WebCore::DocumentLoader*, WebCore::FrameLoadType, WTF::PassRefPtr) + 913
9 WebCore 0x312092b9 WebCore::FrameLoader::load(WebCore::DocumentLoader*) + 169
10 WebCore 0x312091e5 WebCore::FrameLoader::load(WebCore::ResourceRequest const&, WebCore::SubstituteData const&, bool) + 241
11 WebKit 0x350b3f5f -[WebFrame _loadData:MIMEType:textEncodingName:baseURL:unreachableURL:] + 1119
12 WebKit 0x350b3797 -[WebFrame _loadHTMLString:baseURL:unreachableURL:] + 79
13 WebKit 0x350b37bb -[WebFrame loadHTMLString:baseURL:] + 31
14 WebCore 0x311950b5 HandleRunSource + 365
15 CoreFoundation 0x35367ad3 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
16 CoreFoundation 0x35367335 __CFRunLoopDoSources0 + 365
17 CoreFoundation 0x35366045 __CFRunLoopRun + 653
18 CoreFoundation 0x352e94a5 CFRunLoopRunSpecific + 301
19 CoreFoundation 0x352e936d CFRunLoopRunInMode + 105
20 WebCore 0x311e8ca3 _ZL12RunWebThreadPv + 403
21 libsystem_c.dylib 0x32756735 _pthread_start + 321
Thread 3:
0 libsystem_kernel.dylib 0x35c39004 mach_msg_trap + 20
1 CoreFoundation 0x353673f3 __CFRunLoopServiceMachPort + 127
2 CoreFoundation 0x3536612b __CFRunLoopRun + 883
3 CoreFoundation 0x352e94a5 CFRunLoopRunSpecific + 301
4 CoreFoundation 0x352e936d CFRunLoopRunInMode + 105
5 Foundation 0x34e22bb9 +[NSURLConnection(Loader) _resourceLoadLoop:] + 309
6 Foundation 0x34e22a81 -[NSThread main] + 73
7 Foundation 0x34eb6591 __NSThread__main__ + 1049
8 libsystem_c.dylib 0x32756735 _pthread_start + 321
Thread 4:
0 libsystem_kernel.dylib 0x35c49570 __select + 20
1 libsystem_c.dylib 0x32756735 _pthread_start + 321
Thread 5:
0 libsystem_kernel.dylib 0x35c39004 mach_msg_trap + 20
1 CoreFoundation 0x353673f3 __CFRunLoopServiceMachPort + 127
2 CoreFoundation 0x3536612b __CFRunLoopRun + 883
3 CoreFoundation 0x352e94a5 CFRunLoopRunSpecific + 301
4 CoreFoundation 0x352e936d CFRunLoopRunInMode + 105
5 YouTube 0x33e336c9 -[YTImageLoader(Internal) _startLoader] + 245
6 Foundation 0x34e22a81 -[NSThread main] + 73
7 Foundation 0x34eb6591 __NSThread__main__ + 1049
8 libsystem_c.dylib 0x32756735 _pthread_start + 321
Thread 6:
0 libsystem_kernel.dylib 0x35c49cd4 __workq_kernreturn + 8
Thread 7 Crashed:
0 WebCore 0x311454e2 _ZL17_WebTryThreadLockb + 202
1 WebCore 0x3114540f WebThreadLock + 55
2 UIKit 0x32e5537b -[UIWebTiledView layoutSubviews] + 43
3 UIKit 0x32e5534b -[UIWebDocumentView layoutSubviews] + 127
4 UIKit 0x32dcaf37 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 183
5 CoreFoundation 0x352f21fb -[NSObject performSelector:withObject:] + 43
6 QuartzCore 0x321c2aa5 -[CALayer layoutSublayers] + 217
7 QuartzCore 0x321c26bd CA::Layer::layout_if_needed(CA::Transaction*) + 217
8 QuartzCore 0x321c6843 CA::Context::commit_transaction(CA::Transaction*) + 227
9 QuartzCore 0x321c657f CA::Transaction::commit() + 315
10 QuartzCore 0x3220dd01 CA::Transaction::release_thread(void*) + 37
11 libsystem_c.dylib 0x327490ff _pthread_tsd_cleanup + 171
12 libsystem_c.dylib 0x32748d7b _pthread_exit + 123
13 libsystem_c.dylib 0x3275a0f3 pthread_exit + 31
14 Foundation 0x34e3237b +[NSThread exit] + 11
15 Foundation 0x34eb65af __NSThread__main__ + 1079
16 libsystem_c.dylib 0x32756735 _pthread_start + 321
Thread 8:
0 libsystem_kernel.dylib 0x35c49cd4 __workq_kernreturn + 8
Thread 9:
0 libsystem_kernel.dylib 0x35c49cd4 __workq_kernreturn + 8
Thread 10:
0 libsystem_kernel.dylib 0x35c49cd4 __workq_kernreturn + 8
Thread 11:
0 libsystem_kernel.dylib 0x35c49cd4 __workq_kernreturn + 8
Thread 7 crashed with ARM Thread State:
r0: 0xffffffff r1: 0x00001100 r2: 0x2ffc850c r3: 0x00000000
r4: 0xbbadbeef r5: 0x00000000 r6: 0x0054b000 r7: 0x2ffc8b4c
r8: 0x0ca32800 r9: 0x3399fc2c r10: 0x2ffc8be4 r11: 0x2ffc8ebc
ip: 0x3ee8e270 sp: 0x2ffc8b40 lr: 0x35790fef pc: 0x32c7f4e2
cpsr: 0x60000030
Binary Images:
[cut cause of char limit]
I have no idea what happend, anyone an idea?
The problem is that you send messages to UI objects from a background thread, which is forbidden.
Thread 7 crashed with a stack trace into UIView's layout mechanism. The fact that thread 7 is in this code probably results from a setNeedsLayout or some other method being sent from this background thread.
I think web view finished loading and trying to reload view but view controller was poped and released,you need to add this in viewWillDisappear method:
- (void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
if ([webView isLoading]) {
[webView stopLoading];
}
}
The project that I am on sees a similar exception for a WinTel based GWT App running on the WebKit. It has been determined that this particular problem only occurs when the WebKit runs out of memory.

iPhone App crashes even if ARC... help me finding the issue please

i'm developing a hangman game for iPhone and iPad but sometimes it crashes.
here's the crash log of Xcode:
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread: 0
Last Exception Backtrace:
0 CoreFoundation 0x353e788f `__exceptionPreprocess`+ 163
1 libobjc.A.dylib 0x3778e259 objc_exception_throw + 33
2 CoreFoundation 0x353e7789 +[NSException raise:format:] + 1
3 CoreFoundation 0x353e77ab +[NSException raise:format:] + 35
4 CoreFoundation 0x35354fed`-[__NSCFString characterAtIndex:]`+ 89
5 Poke Hangman 0x000e41f5 -[ViewController setStringWithDatabase::](ViewController.m:194)
6 Poke Hangman 0x000e388b -[ViewController preparaStringhe:] (ViewController.m:39)
7 Poke Hangman 0x000e4685 -[ViewController cambia] (ViewController.m:248)
8 Poke Hangman 0x000e3bc5 -[ViewController checkChar:] (ViewController.m:81)
9 Poke Hangman 0x000e6155 -[ViewController ButtonG:] (ViewController.m:579)
10 CoreFoundation 0x353413fd -[NSObject performSelector:withObject:withObject:] + 53
11 UIKit 0x32e36e07 -[UIApplication sendAction:to:from:forEvent:] + 63
12 UIKit 0x32e36dc3 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 31
13 UIKit 0x32e36da1 -[UIControl sendAction:to:forEvent:] + 45
14 UIKit 0x32e36b11 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 493
15 UIKit 0x32e37449 -[UIControl touchesEnded:withEvent:] + 477
16 UIKit 0x32e3592b -[UIWindow _sendTouchesForEvent:] + 319
17 UIKit 0x32e35319 -[UIWindow sendEvent:] + 381
18 UIKit 0x32e1b695 -[UIApplication sendEvent:] + 357
19 UIKit 0x32e1af3b _UIApplicationHandleEvent + 5827
20 GraphicsServices 0x36fda22b PurpleEventCallback + 883
21 CoreFoundation 0x353bb523 <br>`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__`+ 39
22 CoreFoundation 0x353bb4c5 __CFRunLoopDoSource1 + 141
23 CoreFoundation 0x353ba313 __CFRunLoopRun + 1371
24 CoreFoundation 0x3533d4a5 CFRunLoopRunSpecific + 301
25 CoreFoundation 0x3533d36d CFRunLoopRunInMode + 105
26 GraphicsServices 0x36fd9439 GSEventRunModal + 137
27 UIKit 0x32e49cd5 UIApplicationMain + 1081
28 Poke Hangman 0x000e3263 main (main.m:16)
29 Poke Hangman 0x000e3208 start + 40
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x35c9d32c __pthread_kill + 8
1 libsystem_c.dylib 0x327e9208 pthread_kill + 48
2 libsystem_c.dylib 0x327e2298 abort + 88
3 libc++abi.dylib 0x3579ff64 abort_message + 40
4 libc++abi.dylib 0x3579d346 _ZL17default_terminatev + 18
5 libobjc.A.dylib 0x3778e350 _objc_terminate + 140
6 libc++abi.dylib 0x3579d3be _ZL19safe_handler_callerPFvvE + 70
7 libc++abi.dylib 0x3579d44a std::terminate() + 14
8 libc++abi.dylib 0x3579e81e __cxa_rethrow + 82
9 libobjc.A.dylib 0x3778e2a2 objc_exception_rethrow + 6
10 CoreFoundation 0x3533d506 CFRunLoopRunSpecific + 398
11 CoreFoundation 0x3533d366 CFRunLoopRunInMode + 98
12 GraphicsServices 0x36fd9432 GSEventRunModal + 130
13 UIKit 0x32e49cce UIApplicationMain + 1074
14 Poke Hangman 0x000e325c main (main.m:16)
15 Poke Hangman 0x000e3200 start + 32
Thread 1 name: Dispatch queue: com.apple.libdispatch-manager
Thread 1:
0 libsystem_kernel.dylib 0x35c8d3a8 kevent + 24
1 libdispatch.dylib 0x34277f04 _dispatch_mgr_invoke + 708
2 libdispatch.dylib 0x34277c22 _dispatch_mgr_thread + 30
Thread 2 name: WebThread
Thread 2:
0 libsystem_kernel.dylib 0x35c8d004 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x35c8d1fa mach_msg + 50
2 CoreFoundation 0x353bb3ec __CFRunLoopServiceMachPort + 120
3 CoreFoundation 0x353ba124 __CFRunLoopRun + 876
4 CoreFoundation 0x3533d49e CFRunLoopRunSpecific + 294
5 CoreFoundation 0x3533d366 CFRunLoopRunInMode + 98
6 WebCore 0x3123cc9c _ZL12RunWebThreadPv + 396
7 libsystem_c.dylib 0x327aa72e _pthread_start + 314
8 libsystem_c.dylib 0x327aa5e8 thread_start + 0
Thread 0 crashed with ARM Thread State:
r0: 0x00000000 r1: 0x00000000 r2: 0x00000001 r3: 0x00000000
r4: 0x00000006 r5: 0x3e9f4d98 r6: 0x00000002 r7: 0x2fee09f0
r8: 0x002ad500 r9: 0x00000000 r10: 0x3ee51bc0 r11: 0x00000001
ip: 0x00000148 sp: 0x2fee09e4 lr: 0x327e920f pc: 0x35c9d32c
cpsr: 0x00000010
solved this issue but having a new one:
here's the crash log:
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread: 0
Last Exception Backtrace:
0 CoreFoundation 0x39ee717b`__exceptionPreprocess +`163
1 libobjc.A.dylib 0x34ea095b objc_exception_throw + 31
2 CoreFoundation 0x39ee709d -[NSException initWithCoder:] + 1
3 CoreFoundation 0x39e4bd5b -[__NSCFString characterAtIndex:] + 87
4 Poke Hangman 0x00077493 0x74000 + 13459
5 Poke Hangman 0x0007644b 0x74000 + 9291
6 Poke Hangman 0x00077a35 0x74000 + 14901
7 Poke Hangman 0x00076839 0x74000 + 10297
8 Poke Hangman 0x0007aa7b 0x74000 + 27259
9 UIKit 0x32e4dd09 -[UIApplication sendAction:to:from:forEvent:] + 73
10 UIKit 0x32e4dcbb -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 31
11 UIKit 0x32e4dc95 -[UIControl sendAction:to:forEvent:] + 45
12 UIKit 0x32e4d9eb -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 503
13 UIKit 0x32e4e369 -[UIControl touchesEnded:withEvent:] + 489
14 UIKit 0x32e4c791 -[UIWindow _sendTouchesForEvent:] + 525
15 UIKit 0x32e3a72d -[UIApplication sendEvent:] + 381
16 UIKit 0x32e3a009 _UIApplicationHandleEvent + 6057
17 GraphicsServices 0x33f04603 _PurpleEventCallback + 591
18 GraphicsServices 0x33f04233 PurpleEventCallback + 35
19 CoreFoundation 0x39eb7873 `__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__`+ 35
20 CoreFoundation 0x39eb7817 __CFRunLoopDoSource1 + 139
21 CoreFoundation 0x39eb6611 __CFRunLoopRun + 1385
22 CoreFoundation 0x39e33be5 CFRunLoopRunSpecific + 357
23 CoreFoundation 0x39e33a71 CFRunLoopRunInMode + 105
24 GraphicsServices 0x33f0334b GSEventRunModal + 75
25 UIKit 0x32e607f5 UIApplicationMain + 1121
26 Poke Hangman 0x00075f65 0x74000 + 8037
27 Poke Hangman 0x00075f00 0x74000 + 7936
please help me finding the issue..
here's the section where i think it crashes:
isPresent tells if the user char is present in the word or not
if the user char exists in the correct word, in the critted one it get swapped at the position i. if there isn't the char the score get lower by 20.
sorry for my bad english and hope u will help me ;)
bool isPresent = NO;
for (int i = 0; i < correctWord.length; i++)
if (userCharFromButton == [correctWord characterAtIndex:i])
{
criptedWord = [criptedWord stringByReplacingCharactersInRange:NSMakeRange(i, 1.0) withString:[NSString stringWithFormat:#"%c", userCharFromButton]];
isPresent = YES;
}
word.text = criptedWord;
if (isPresent == NO)
currentlyScore -= 20;
//check if the word is complete
bool complete = YES;
for (int i = 1; i < criptedWord.length; i++)
if ([criptedWord characterAtIndex:i] == '-')
complete = NO;
The crash log shows a backtrace which has been symbolised. From there, you can see on the 5th item of your Last Exception Backtrace
5 Poke Hangman 0x000e41f5 -[ViewController setStringWithDatabase::](ViewController.m:194)
It is in your setStringWithDatabase:: in the ViewController class on line 194 which is causing the exception.
On the line above, you can see
4 CoreFoundation 0x35354fed`-[__NSCFString characterAtIndex:]`+ 89
So your setStringWithDatabase:: must be calling a CoreFoundation characterAtIndex: method which you directly call yourself or something you call invokes it around line 194 in your ViewController class. Common cause would be that your string is nil/empty or you are trying to get a character beyond the range.
The problem doesn't seem to be related to using ARC.
[below is the solution to the second bit]
As mentioned in my answer, your second problem also seems to be similar to the first. You need to make sure your string criptedWord is not nil and there isn't something else related to that variable which is crashing it. In order to diagnose further, you need to symbolise your crash logs first.