UI API called on a background thread com.google.Maps.LabelingBehavior - ios

After upgrading to XCode 9 I suddently get the following warning when I run my app:
Main Thread Checker: UI API called on a background thread: -[UIApplication applicationState]
PID: 15473, TID: 773864, Thread name: com.google.Maps.LabelingBehavior, Queue name: com.apple.root.default-qos.overcommit, QoS: 21
Backtrace:
4 App 0x000000010b8ee524 GMSIsApplicationInBackground + 53
5 App 0x000000010b8dc77a -[GMSForegroundDispatchQueue initWithName:targetQueue:] + 269
6 App 0x000000010b9bc5ee _ZN7gmscore6vector4text8GlyphSetC2ERKNS_4base10reffed_ptrINS0_16TextureAtlasPoolEEEPU28objcproto17OS_dispatch_queue8NSObjectPK8__CTFontff + 344
7 App 0x000000010b9bba58 _ZN7gmscore6vector4text10GlyphCache11GetGlyphSetEPK8__CTFontf + 214
8 App 0x000000010b9b950e _ZN7gmscore6vector4text6GLText14PrefetchGlyphsERKNS_4base10reffed_ptrINS1_10GlyphCacheEEERKNSt3__16vectorItNS9_9allocatorItEEEEPK8__CTFontf + 22
9 App 0x000000010b9b9611 _ZN7gmscore6vector4text6GLText14PrefetchGlyphsERKNS_4base10reffed_ptrINS1_10GlyphCacheEEEPK8__CTLinebf + 207
10 App 0x000000010b9112df _ZN7gmscore6vector12GLPointLabel22PrefetchGlyphsForGroupEPNS0_12GLLabelGroupE + 181
11 App 0x000000010b911207 _ZN7gmscore6vector12GLPointLabel14PrefetchGlyphsEv + 33
12 App 0x000000010b98022a _ZN7gmscore6vector16LabelingBehavior23CreatePendingOperationsERKNSt3__13setINS_4base10reffed_ptrINS0_7GLLabelEEENS2_4lessIS7_EENS2_9allocatorIS7_EEEESE_SE_NS0_13LabelDrawModeE + 1096
13 App 0x000000010b97fb9d _ZN7gmscore6vector16LabelingBehavior14RunLabelingJobERKNS_4base10reffed_ptrINS1_11LabelingJobEEE + 357
14 App 0x000000010b97fa2a ___ZN7gmscore6vector16LabelingBehavior14CommitInternalEPNS_8renderer14EntityRendererE_block_invoke + 22
15 Foundation 0x0000000110bb0948 __NSThreadPerformPerform + 334
16 CoreFoundation 0x00000001117af2b1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
17 CoreFoundation 0x000000011184ed31 __CFRunLoopDoSource0 + 81
18 CoreFoundation 0x0000000111793c19 __CFRunLoopDoSources0 + 185
19 CoreFoundation 0x00000001117931ff __CFRunLoopRun + 1279
20 CoreFoundation 0x0000000111792a89 CFRunLoopRunSpecific + 409
21 Foundation 0x0000000110b6ae5e -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 274
22 App 0x000000010b9bace5 -[GMSx_GTMSimpleWorkerThread main] + 337
23 Foundation 0x0000000110b788ac __NSThread__start__ + 1197
24 libsystem_pthread.dylib 0x000000011323393b _pthread_body + 180
25 libsystem_pthread.dylib 0x0000000113233887 _pthread_body + 0
26 libsystem_pthread.dylib 0x000000011323308d thread_start + 13
Error Domain=kCLErrorDomain Code=0 "(null)"
I can narrow it down to the problem happens when I assign the map to my view.
override func viewDidLoad() {
super.viewDidLoad()
UIApplication.shared.isIdleTimerDisabled = true
GPSManager.instance.startGPS()
setupLayout()
map = GMSMapView.map(withFrame: CGRect.zero, camera: getCamera(location: initialLocation, zoom: 10))
map.mapType = .hybrid
map.delegate = self
map.settings.consumesGesturesInView = false
self.view.addSubview(map) <-- This is where is goes wrong
self.view.sendSubview(toBack: map)
configureMenus()
}
Is this something I can fix or is it inside Google Maps? Cheers

The problem is inside the Google library.
If you don't want this kind of warning you can disable Main Thread Checker inside the Scheme options.
Go Product > Scheme > Manage Schemes search the Scheme you use for your tests and press Edit... in the left sidebar press Run and then go to Diagnostics and uncheck Main Thread Checker checkbox.
This is only a temporal solution if you don't want these warnings. I do not recommend it because you could introduce bugs if call UI inside a background thread
If you have test you should disable the checkbox in Test option as I explained in Xcode 9, iOS 11, XCUITest failure: Main Thread Checker Flurry Analytics if you do not want the tests crash

Related

App is getting crashed on app launch in iOS 13 beta version

Here is the crash report and the crash is only happening on iOS 13 beta version :-
Crashed: com.apple.main-thread
0 libsystem_pthread.dylib 0x1ae056484 pthread_get_qos_class_np + 8
1 Foundation 0x1ae664340 -[NSThread qualityOfService] + 80
2 Foundation 0x1ae626ebc -[NSObject(NSThreadPerformAdditions) performSelector:onThread:withObject:waitUntilDone:modes:] + 280
3 Foundation 0x1ae628df8 -[NSObject(NSThreadPerformAdditions) performSelector:onThread:withObject:waitUntilDone:] + 116
4 libAXSpeechManager.dylib 0x1d0176884 -[AXSpeechManager isSpeaking] + 112
5 libAXSpeechManager.dylib 0x1d0171b60 -[AXSpeechManager _didBeginInterruption] + 52
6 libAXSpeechManager.dylib 0x1d0171f1c -[AXSpeechManager _handleAudioInterruption:] + 504
7 CoreFoundation 0x1ae2929ac __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 20
8 CoreFoundation 0x1ae2929f4 ___CFXRegistrationPost1_block_invoke + 64
9 CoreFoundation 0x1ae291d54 _CFXRegistrationPost1 + 368
10 CoreFoundation 0x1ae291a20 ___CFXNotificationPost_block_invoke + 104
11 CoreFoundation 0x1ae20dd38 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1416
12 CoreFoundation 0x1ae291370 _CFXNotificationPost + 1244
13 Foundation 0x1ae5edcf8 -[NSNotificationCenter postNotificationName:object:userInfo:] + 60
14 AVFAudio 0x1bac4603c -[AVAudioSession privateInterruptionWithInfo:] + 988
15 AVFAudio 0x1bac4880c (anonymous namespace)::HandlePropertyListenerCallback(unsigned int, objc_selector*, NSObject*) + 68
16 libdispatch.dylib 0x1ae004658 _dispatch_call_block_and_release + 24
17 libdispatch.dylib 0x1ae0051cc _dispatch_client_callout + 16
18 libdispatch.dylib 0x1adfe83e0 _dispatch_main_queue_callback_4CF$VARIANT$armv81 + 996
19 CoreFoundation 0x1ae2b4c74 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
20 CoreFoundation 0x1ae2afc68 __CFRunLoopRun + 2004
21 CoreFoundation 0x1ae2af16c CFRunLoopRunSpecific + 464
22 GraphicsServices 0x1b80d9328 GSEventRunModal + 104
23 UIKitCore 0x1b2317f6c UIApplicationMain + 1936
24 Quickride 0x10086803c main + 37 (AppDelegate.swift:37)
25 libdyld.dylib 0x1ae13a424 start + 4
I have checked on various platforms for this issue. But have not found any solution related to it.Please provide any solution related to it.
It is crashing on app launch itself and this is the report it shows on fabric
I've the same issue on iOS 13 and it's my most serious crash on Crashlytics.
It occurs only in iOS 13 and above. Unfortunately also in the latest 13.1.2.
Starting by the iOS 13 release I've detected a strange warning when I put my app in background the debug console print Can't end BackgroundTask: no background task exists with identifier x, or it may have already been ended. Break in UIApplicationEndBackgroundTaskError() to debug.
Maybe the issues are related.

CMotionManager crash on instantiation

EDIT: This appears to be resolved on iOS 13. Leaving all the original details below.
I'm getting a crash when instantiating my CMMotionManager object for Core Motion. This is on an iPhone Xs running iOS 12.0.1.
I can reliably reproduce this with a single-view app, with the following view controller.
import UIKit
import CoreMotion
class ViewController: UIViewController {
var motion: CMMotionManager?
override func viewDidLoad() {
super.viewDidLoad()
// This causes a crash on iPhone Xs, iOS 12.0.1
self.motion = CMMotionManager()
}
}
Full sample project is at https://github.com/doctorcolinsmith/motiontestcrash/tree/master
When running the above, I am getting a fault on a thread with the following output in the debugger.
=================================================================
Main Thread Checker: UI API called on a background thread: -[UIApplication applicationState]
PID: 3634, TID: 630341, Thread name: com.apple.CoreMotion.MotionThread, Queue name: com.apple.root.default-qos.overcommit, QoS: 0
Backtrace:
4 libobjc.A.dylib 0x000000019b0d3894 <redacted> + 56
5 CoreMotion 0x00000001a19337a4 CoreMotion + 305060
6 CoreMotion 0x00000001a1933cd8 CoreMotion + 306392
7 CoreMotion 0x00000001a1933be8 CoreMotion + 306152
8 CoreMotion 0x00000001a19653cc CoreMotion + 508876
9 CoreMotion 0x00000001a196542c CoreMotion + 508972
10 CoreFoundation 0x000000019be6c888 <redacted> + 28
11 CoreFoundation 0x000000019be6c16c <redacted> + 276
12 CoreFoundation 0x000000019be67470 <redacted> + 2324
13 CoreFoundation 0x000000019be66844 CFRunLoopRunSpecific + 452
14 CoreFoundation 0x000000019be675a8 CFRunLoopRun + 84
15 CoreMotion 0x00000001a1964d64 CoreMotion + 507236
16 libsystem_pthread.dylib 0x000000019bae1a04 <redacted> + 132
17 libsystem_pthread.dylib 0x000000019bae1960 _pthread_start + 52
18 libsystem_pthread.dylib 0x000000019bae9df4 thread_start + 4
2018-10-24 16:19:31.423680-0700 motiontest[3634:630341] [reports] Main Thread Checker: UI API called on a background thread: -[UIApplication applicationState]
PID: 3634, TID: 630341, Thread name: com.apple.CoreMotion.MotionThread, Queue name: com.apple.root.default-qos.overcommit, QoS: 0
Backtrace:
4 libobjc.A.dylib 0x000000019b0d3894 <redacted> + 56
5 CoreMotion 0x00000001a19337a4 CoreMotion + 305060
6 CoreMotion 0x00000001a1933cd8 CoreMotion + 306392
7 CoreMotion 0x00000001a1933be8 CoreMotion + 306152
8 CoreMotion 0x00000001a19653cc CoreMotion + 508876
9 CoreMotion 0x00000001a196542c CoreMotion + 508972
10 CoreFoundation 0x000000019be6c888 <redacted> + 28
11 CoreFoundation 0x000000019be6c16c <redacted> + 276
12 CoreFoundation 0x000000019be67470 <redacted> + 2324
13 CoreFoundation 0x000000019be66844 CFRunLoopRunSpecific + 452
14 CoreFoundation 0x000000019be675a8 CFRunLoopRun + 84
15 CoreMotion 0x00000001a1964d64 CoreMotion + 507236
16 libsystem_pthread.dylib 0x000000019bae1a04 <redacted> + 132
17 libsystem_pthread.dylib 0x000000019bae1960 _pthread_start + 52
18 libsystem_pthread.dylib 0x000000019bae9df4 thread_start + 4
(lldb)
Has anyone encountered this before or have an idea on how to solve the crash?
Well, I've tested your application both physical iPhone 6S and iPhone 7 - obviously with iOS 12.0.1. I've also checked for a couple of things in your project and couldn't reproduce your problem at all - not even in simulators - and I don't think it's possible to download a simulator with specific fixes (12.0.x), only with minor version updates - so 12.1 being the next one. This looks really specific on iPhone XS hardware, and I would suggest you to fill an issue with Apple support.
EDIT: Well, I saw that you've already filled a bug report on openradar. This guy even referenced the bug report status on openradar-mirror.
I don't know much about CoreMotion, but the error message tells you you're trying to call a UI action on a background thread. Try putting your code into:
DispatchQueue.main.async {
//your code here
}
It also seems you're trying to do UI related actions in viewDidLoad(). Technically that's fine, but remember that some views probably aren't layed out at that point in time.

Issues after updating to IOS11 and Xcode9!! "com.google.Maps.LabelingBehavior", "TIC Read Status"

I have updated my phone and Xcode to the most recent update and I am getting tons of warnings.
First one is 2017-09-21 00:23:15.669466+0100 The Kallos[12068:1279021] TIC Read Status [1:0x0]: 1:57
and there is literally 2-3 posts about this which doesn't even explain what it is!
This is another warning, I found a similar post which explains this issue but it doesn't give a solution on how to fix it!
Main Thread Checker: UI API called on a background thread: -[UIApplication applicationState]
PID: x, TID: x, Thread name: com.google.Maps.LabelingBehavior, Queue name: com.apple.root.default-qos.overcommit, QoS: 21
Backtrace:
4 The Kallos 0x0000000105d1e4f4 GMSIsApplicationInBackground + 53
5 The Kallos 0x0000000105d0c74a -[GMSForegroundDispatchQueue initWithName:targetQueue:] + 269
6 The Kallos 0x0000000105dec5be _ZN7gmscore6vector4text8GlyphSetC2ERKNS_4base10reffed_ptrINS0_16TextureAtlasPoolEEEPU28objcproto17OS_dispatch_queue8NSObjectPK8__CTFontff + 344
7 The Kallos 0x0000000105deba28 _ZN7gmscore6vector4text10GlyphCache11GetGlyphSetEPK8__CTFontf + 214
8 The Kallos 0x0000000105de94de _ZN7gmscore6vector4text6GLText14PrefetchGlyphsERKNS_4base10reffed_ptrINS1_10GlyphCacheEEERKNSt3__16vectorItNS9_9allocatorItEEEEPK8__CTFontf + 22
9 The Kallos 0x0000000105de95e1 _ZN7gmscore6vector4text6GLText14PrefetchGlyphsERKNS_4base10reffed_ptrINS1_10GlyphCacheEEEPK8__CTLinebf + 207
10 The Kallos 0x0000000105d412af _ZN7gmscore6vector12GLPointLabel22PrefetchGlyphsForGroupEPNS0_12GLLabelGroupE + 181
11 The Kallos 0x0000000105d411d7 _ZN7gmscore6vector12GLPointLabel14PrefetchGlyphsEv + 33
12 The Kallos 0x0000000105db01fa _ZN7gmscore6vector16LabelingBehavior23CreatePendingOperationsERKNSt3__13setINS_4base10reffed_ptrINS0_7GLLabelEEENS2_4lessIS7_EENS2_9allocatorIS7_EEEESE_SE_NS0_13LabelDrawModeE + 1096
13 The Kallos 0x0000000105dafb6d _ZN7gmscore6vector16LabelingBehavior14RunLabelingJobERKNS_4base10reffed_ptrINS1_11LabelingJobEEE + 357
14 The Kallos 0x0000000105daf9fa ___ZN7gmscore6vector16LabelingBehavior14CommitInternalEPNS_8renderer14EntityRendererE_block_invoke + 22
15 Foundation 0x00000001094ca948 __NSThreadPerformPerform + 334
16 CoreFoundation 0x000000010816c2b1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
17 CoreFoundation 0x000000010820bd31 __CFRunLoopDoSource0 + 81
18 CoreFoundation 0x0000000108150c19 __CFRunLoopDoSources0 + 185
19 CoreFoundation 0x00000001081501ff __CFRunLoopRun + 1279
20 CoreFoundation 0x000000010814fa89 CFRunLoopRunSpecific + 409
21 Foundation 0x0000000109484e5e -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 274
22 The Kallos 0x0000000105deacb5 -[GMSx_GTMSimpleWorkerThread main] + 337
23 Foundation 0x00000001094928ac __NSThread__start__ + 1197
24 libsystem_pthread.dylib 0x000000010f73393b _pthread_body + 180
25 libsystem_pthread.dylib 0x000000010f733887 _pthread_body + 0
26 libsystem_pthread.dylib 0x000000010f73308d thread_start + 13
2017-09-21 00:23:15.827609+0100 The Kallos[12068:1279035] [reports] Main Thread Checker: UI API called on a background thread: -[UIApplication applicationState]
PID: x, TID: x, Thread name: com.google.Maps.LabelingBehavior, Queue name: com.apple.root.default-qos.overcommit, QoS: 21
Backtrace:
4 The Kallos 0x0000000105d1e4f4 GMSIsApplicationInBackground + 53
5 The Kallos 0x0000000105d0c74a -[GMSForegroundDispatchQueue initWithName:targetQueue:] + 269
6 The Kallos 0x0000000105dec5be _ZN7gmscore6vector4text8GlyphSetC2ERKNS_4base10reffed_ptrINS0_16TextureAtlasPoolEEEPU28objcproto17OS_dispatch_queue8NSObjectPK8__CTFontff + 344
7 The Kallos 0x0000000105deba28 _ZN7gmscore6vector4text10GlyphCache11GetGlyphSetEPK8__CTFontf + 214
8 The Kallos 0x0000000105de94de _ZN7gmscore6vector4text6GLText14PrefetchGlyphsERKNS_4base10reffed_ptrINS1_10GlyphCacheEEERKNSt3__16vectorItNS9_9allocatorItEEEEPK8__CTFontf + 22
9 The Kallos 0x0000000105de95e1 _ZN7gmscore6vector4text6GLText14PrefetchGlyphsERKNS_4base10reffed_ptrINS1_10GlyphCacheEEEPK8__CTLinebf + 207
10 The Kallos 0x0000000105d412af _ZN7gmscore6vector12GLPointLabel22PrefetchGlyphsForGroupEPNS0_12GLLabelGroupE + 181
11 The Kallos 0x0000000105d411d7 _ZN7gmscore6vector12GLPointLabel14PrefetchGlyphsEv + 33
12 The Kallos 0x0000000105db01fa _ZN7gmscore6vector16LabelingBehavior23CreatePendingOperationsERKNSt3__13setINS_4base10reffed_ptrINS0_7GLLabelEEENS2_4lessIS7_EENS2_9allocatorIS7_EEEESE_SE_NS0_13LabelDrawModeE + 1096
13 The Kallos 0x0000000105dafb6d _ZN7gmscore6vector16LabelingBehavior14RunLabelingJobERKNS_4base10reffed_ptrINS1_11LabelingJobEEE + 357
14 The Kallos 0x0000000105daf9fa ___ZN7gmscore6vector16LabelingBehavior14CommitInternalEPNS_8renderer14EntityRendererE_block_invoke + 22
15 Foundation 0x00000001094ca948 __NSThreadPerformPerform + 334
16 CoreFoundation 0x000000010816c2b1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
17 CoreFoundation 0x000000010820bd31 __CFRunLoopDoSource0 + 81
18 CoreFoundation 0x0000000108150c19 __CFRunLoopDoSources0 + 185
19 CoreFoundation 0x00000001081501ff __CFRunLoopRun + 1279
20 CoreFoundation 0x000000010814fa89 CFRunLoopRunSpecific + 409
21 Foundation 0x0000000109484e5e -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 274
22 The Kallos 0x0000000105deacb5 -[GMSx_GTMSimpleWorkerThread main] + 337
23 Foundation 0x00000001094928ac __NSThread__start__ + 1197
24 libsystem_pthread.dylib 0x000000010f73393b _pthread_body + 180
25 libsystem_pthread.dylib 0x000000010f733887 _pthread_body + 0
26 libsystem_pthread.dylib 0x000000010f73308d thread_start + 13
Next warning is
CoreData: annotation: Failed to load optimized model at path '/Users/xx/Library/Developer/CoreSimulator/Devices/17AA6A5E-FA21-40BF-8123-2CAEE29D4BBE/data/Containers/Bundle/Application/2C3F9016-4605-4DB8-A480-59B95C5E2994/The Kallos.app/GoogleMaps.bundle/GMSCacheStorage.momd/Storage.omo'
CoreData: annotation: Failed to load optimized model at path '/Users/xx/Library/Developer/CoreSimulator/Devices/17AA6A5E-FA21-40BF-8123-2CAEE29D4BBE/data/Containers/Bundle/Application/2C3F9016-4605-4DB8-A480-59B95C5E2994/The Kallos.app/GoogleMaps.bundle/GMSCacheStorage.momd/Storage.omo'
CoreData: annotation: Failed to load optimized model at path '/Users/xx/Library/Developer/CoreSimulator/Devices/17AA6A5E-FA21-40BF-8123-2CAEE29D4BBE/data/Containers/Bundle/Application/2C3F9016-4605-4DB8-A480-59B95C5E2994/The Kallos.app/GoogleMaps.bundle/GMSCacheStorage.momd/Storage.omo'
I feel like this is a problem with the GoogleMaps API and not my code but Im not sure about that.
I will be more than happy to provide more information if needed but my project has around 11-12k lines of code so I don't really know what to upload.
This issue was reported in Google issue tracker as well:
https://issuetracker.google.com/issues/63322270
Google is aware of it and current state of the bug is Accepted, I would expect a fix in the next version of Google Maps SDK library 2.5.0
Feel free to add star in the bug to add your vote and subscribe to notifications from Google.
UPDATE
The issue was marked as fixed today (October 24, 2017). The Google rep wrote
We believe that this issue should be solved in the Maps iOS SDK v2.5 release. If this issue still occurs, please let us know.
The problem was that i've use library for change system font and there was a misspelling in name of the font that's way this weird crash appear

Weird iOS UIWebView Crash called WTF Crash

I am using UIWebViews in some of the screens, because I need a perfect Html text parsing.
According to crash reports a huge number of crashes, called WTF Crash, occur on these screens. Here is a trace of that crash
Crashed: WebThread
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x00000000bbadbeef
Thread : Crashed: WebThread
0 JavaScriptCore 0x184fd2710 WTFCrash + 72
1 JavaScriptCore 0x184fd2708 WTFCrash + 64
2 WebCore 0x1852b7d78 <redacted> + 362
3 WebCore 0x1852b7bec <redacted> + 44
4 CoreFoundation 0x1817d8588 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
5 CoreFoundation 0x1817d632c __CFRunLoopDoObservers + 372
6 CoreFoundation 0x1817d6674 __CFRunLoopRun + 696
7 CoreFoundation 0x181705680 CFRunLoopRunSpecific + 384
8 WebCore 0x1852b5998 <redacted> + 456
9 libsystem_pthread.dylib 0x18148bb28 <redacted> + 156
10 libsystem_pthread.dylib 0x18148ba8c _pthread_start + 154
11 libsystem_pthread.dylib 0x181489028 thread_start + 4
There is no OS version, or device relation on this crash.
I am not doing anything fancy on using UIWebView as well. It is added to nib like every other component, and in the implementation file I use it like the following
self.webView.scrollView.scrollEnabled = NO;
self.webView.scrollView.bounces = NO;
self.webView.opaque = NO;
self.webView.backgroundColor = [UIColor clearColor];
self.webView.delegate = self;
[self.webView loadHTMLString:htmlString baseURL:nil];
Any suggestions on how to solve WTF Crash?
Edit: Here is how htmlString looks like
Printing description of htmlString:
<html><body style="font-family:HelveticaNeue; font-size:10; background-color:#E5E4E4; text-align:left; color:#696969 ">test string</body></html>
I don't know how you are creating your UIWebView. But I was having a similiar issue with a WTFCrash and I was able to solve it by making sure that the UIWebView was being created on the main thread:
- (void)createWebView{
if (![NSThread isMainThread]) {
dispatch_async(dispatch_get_main_queue(), ^{
[self createWebView];
});
return;
}
self.webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 320)];
//Rest of my code
}
Are you debugging your web view with Safari? If yes, the crash should be gone after you quit Safari.
I was facing a similar crash with WKWebView, and I was sure the same code worked happily 3 days ago. hlung's comments saved me, you can find it HERE.
For your reference, following is a piece of the crash log in my case.
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x00000000dbbdfb10
Triggered by Thread: 0
Filtered syslog:
None found
Thread 0 Crashed:
0 JavaScriptCore 0x225d74c6 WTF::HashSet<JSC::MarkedArgumentBuffer*, WTF::PtrHash<JSC::MarkedArgumentBuffer*>, WTF::HashTraits<JSC::MarkedArgumentBuffer*> >::remove(JSC::MarkedArgumentBuffer* const&) + 54
1 JavaScriptCore 0x22620b41 JSC::VM::~VM() + 211
2 JavaScriptCore 0x22197e57 JSC::JSLockHolder::~JSLockHolder() + 73
3 JavaScriptCore 0x2248defd JSContextGroupRelease + 61
4 JavaScriptCore 0x2250e37d -[JSVirtualMachine dealloc] + 27
5 libobjc.A.dylib 0x1dac5195 objc_object::sidetable_release(bool) + 239
6 JavaScriptCore 0x2248d261 -[JSContext dealloc] + 125
7 libobjc.A.dylib 0x1dac5195 objc_object::sidetable_release(bool) + 239
8 JavaScriptCore 0x226470af WTF::RunLoop::TimerBase::timerFired(__CFRunLoopTimer*, void*) + 25
9 CoreFoundation 0x1e807357 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 15
10 CoreFoundation 0x1e807029 __CFRunLoopDoTimer + 897
11 CoreFoundation 0x1e8069e1 __CFRunLoopDoTimers + 221
12 CoreFoundation 0x1e804cc5 __CFRunLoopRun + 1365
13 CoreFoundation 0x1e754073 CFRunLoopRunSpecific + 487
14 CoreFoundation 0x1e753e81 CFRunLoopRunInMode + 105
15 GraphicsServices 0x1ff00bfd GSEventRunModal + 157
16 UIKit 0x2390e82f -[UIApplication _run] + 575
17 UIKit 0x23908f61 UIApplicationMain + 151
18 MyApp 0x00488b29 0x2c000 + 4573993
19 libdyld.dylib 0x1df1e50b start + 3
WebKit, the engine behind Web Views, can raise a crash when it sees a memory problem.
These are identified by the special Hex Word 0x00000000bbadbeef as you have found.
The web page you are visiting seems trivial, so it is a surprise that you are having problems. I recommend you follow the WebKit debugging facilities described at:
https://webkit.org/debugging-webkit/#ios-simulator
Please update your question with any logs or insights this reveals.
It was a Google Ads issue, already fixed for sure on version 7.35.0 of October, 17 and newer versions.
You should be able to fix the issue updating your pod.
From the Google Mobile Ads SDK Developers Team mailing:
"The issue has been fixed by the team and it should go live in an upcoming SDK release (release notes)." (August, 20)
"Issue has been fixed and live already." (October, 17)
Source: https://groups.google.com/d/msg/google-admob-ads-sdk/XL35wo6mQts/R2LlGZDxBwAJ
Release Notes: https://developers.google.com/admob/ios/rel-notes

iOS9 'modifying the autolayout engine from a background thread' without using autolayout

I started getting this warning :
This application is modifying the autolayout engine from a background
thread, which can lead to engine corruption and weird crashes. This
will cause an exception in a future release.
Here is the backtrace with the warning message :
Stack:(
0 CoreFoundation 0x25542303 <redacted> + 150
1 libobjc.A.dylib 0x24d0edff objc_exception_throw + 38
2 CoreFoundation 0x25542231 <redacted> + 0
3 Foundation 0x25e25bbb <redacted> + 170
4 Foundation 0x25ccb637 <redacted> + 38
5 UIKit 0x297e0431 <redacted> + 52
6 UIKit 0x297e0e1f <redacted> + 222
7 UIKit 0x297fd52d <redacted> + 96
8 UIKit 0x29efe579 <redacted> + 320
9 UIKit 0x299dc8e9 <redacted> + 148
10 UIKit 0x299cb44f <redacted> + 42
11 UIKit 0x296d5a83 <redacted> + 714
12 QuartzCore 0x277b1ad5 <redacted> + 128
13 QuartzCore 0x277ad1d1 <redacted> + 352
14 QuartzCore 0x277ad061 <redacted> + 16
15 QuartzCore 0x277ac581 <redacted> + 368
16 QuartzCore 0x277ac233 <redacted> + 614
17 QuartzCore 0x277d9b63 <redacted> + 310
18 libsystem_pthread.dylib 0x25279905 <redacted> + 508
19 libsystem_pthread.dylib 0x25279507 <redacted> + 86
20 libsystem_pthread.dylib 0x2527a485 pthread_exit + 28
21 Foundation 0x25ca31d7 <redacted> + 10
22 Foundation 0x25d5e34f <redacted> + 1178
23 libsystem_pthread.dylib 0x2527ac7f <redacted> + 138
24 libsystem_pthread.dylib 0x2527abf3 _pthread_start + 110
25 libsystem_pthread.dylib 0x25278a08 thread_start + 8
As far as i know i don't use Autolayout (as i want the app to be iOS 5.1.1 compatible). and also i don't seem to be within the reported backtrace.
I also have the PSPDFUIKitMainThreadGuard class enabled, which should be checking the main thread accesses but nothing trigered out of this thing.
Is there any way how to find out what is doing such a thing?
Question This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes doesn't explain how to debug such thing.
Whether or not you are using Autolayout directly is not the issue at hand. The OS is converting legacy autoresizingMask to modern NSLayoutConstraint under the hood.
The issue has to do with modifying the UI from anywhere but the main tread.
This typically happens when:
responding to a NSNotification
returning from an async method
executing a completion block on a thread you do not control
explicitly scheduling a task in the background
Note about The app doesn't crash...
The app will crash. All you need is time and a few thousand users...

Resources