最近我在Crashlytics上遇到很多崩溃问题:
QuartzCore
CA::AttrList::set(unsigned int, _CAValueType, void const*)
这种崩溃是由Google Admob SDK引起的,仅在iOS 8.4.1上引起。我做了一些研究,找出导致这种情况的原因并找到解决方案,我在Admob Docs中发现了一份报告:https://groups.google.com/forum/#!category-topic/google-admob-ads-sdk/Qnfr17UHJ6Q,它有类似的崩溃报告。
他们说我必须关闭UIView
动画GADBannerView
:[GADBannerView setAnimationsEnabled:NO];
,但这根本不是解决方案,因为Google Banner View不会将UIViewAnimation子类化,因此它会转向关闭应用程序内的所有动画,包括push,tableview animation ..etc
我不知道是否有人之前确实遇到过此次崩溃,原因是什么,请注意我在申请时根本没有使用WebView
。
崩溃线程详细信息在这里:
#0
Crashed: WebThread
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x000000007fe10153
Raw
0 libobjc.A.dylib
objc_msgSend + 21
1 QuartzCore
CA::AttrList::set(unsigned int, _CAValueType, void const*) + 412
2
QuartzCore
CAAnimation_setter(CAAnimation*, unsigned int, _CAValueType, void const*) + 162
3 QuartzCore
-[CAAnimation setDelegate:] + 18
4 UIKit
-[UIViewAnimationState setAnimationAttributes:correctZeroDuration:skipDelegateAssignment:customCurve:] + 742
5 UIKit
-[UIViewAnimationState animationForLayer:forKey:forView:] + 648
6 UIKit
-[UIViewAnimationState actionForLayer:forKey:forView:] + 40
7 UIKit
+[UIView(Animation) _defaultUIViewActionForLayer:forKey:] + 88
8 UIKit
-[UIView(CALayerDelegate) actionForLayer:forKey:] + 116
9 QuartzCore
-[CALayer actionForKey:] + 146
10 QuartzCore
actionForKey(CALayer*, CA::Transaction*, NSString*) + 56
11 QuartzCore
CA::Layer::begin_change(CA::Transaction*, unsigned int, objc_object*&) + 130
12 QuartzCore
CA::Layer::set_position(CA::Vec2<double> const&, bool) + 348
13 QuartzCore
-[CALayer setPosition:] + 54
14 QuartzCore
-[CALayer setFrame:] + 574
15 UIKit
-[UIView(Geometry) setFrame:] + 264
16 UIKit
-[UIImageView _setViewGeometry:forMetric:] + 170
17 UIKit
-[UIImageView setFrame:] + 38
18 UIKit
-[UISlider _layoutSubviewsForBoundsChange:] + 1082
19 UIKit
-[UISlider _sliderAnimationDidStop:finished:context:] + 74
20 UIKit
-[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 184
21 UIKit
+[UIViewAnimationState popAnimationState] + 320
22 UIKit
-[UISlider setValue:animated:] + 796
23 MediaPlayer
-[MPVolumeSlider volumeController:volumeValueDidChange:] + 78
24 MediaPlayer
-[MPVolumeController updateVolumeValue] + 252
25 MediaPlayer
-[MPVolumeSlider didMoveToSuperview] + 126
26 UIKit
-[UIView(Hierarchy) _postMovedFromSuperview:] + 428
27 UIKit
-[UIView(Internal) _addSubview:positioned:relativeTo:] + 1498
28 UIKit
-[UIView(Hierarchy) addSubview:] + 30
29 MediaPlayer
-[MPVolumeView _createSubviews] + 236
30 MediaPlayer
-[MPVolumeView _initWithStyle:] + 212
31 MediaPlayer
-[MPVolumeView initWithFrame:style:] + 80
32 MediaPlayer
-[MPVolumeView initWithFrame:] + 38
33 UIKit
-[UIView init] + 44
34 WebCore
-[WebMediaSessionHelper allocateVolumeView] + 264
35 WebCore
-[WebMediaSessionHelper initWithCallback:] + 394
36 WebCore
WebCore::MediaSessionManageriOS::MediaSessionManageriOS() + 172
37 WebCore
WebCore::MediaSessionManager::sharedManager() + 124
38 WebCore
WebCore::MediaSession::MediaSession(WebCore::MediaSessionClient&) + 32
39 WebCore
WebCore::HTMLMediaSession::create(WebCore::MediaSessionClient&) + 20
40 WebCore
WebCore::HTMLMediaElement::HTMLMediaElement(WebCore::QualifiedName const&, WebCore::Document&, bool) + 1046
41 WebCore
WebCore::HTMLAudioElement::create(WebCore::QualifiedName const&, WebCore::Document&, bool) + 36
42 WebCore
WebCore::audioConstructor(WebCore::QualifiedName const&, WebCore::Document&, WebCore::HTMLFormElement*, bool) + 56
43 WebCore
WebCore::HTMLElementFactory::createElement(WebCore::QualifiedName const&, WebCore::Document&, WebCore::HTMLFormElement*, bool) + 232
44 WebCore
WebCore::HTMLDocument::createElement(WTF::AtomicString const&, int&) + 88
45 WebCore
WebCore::jsDocumentPrototypeFunctionCreateElement(JSC::ExecState*) + 242
46 JavaScriptCore
llint_entry + 21314
47 JavaScriptCore
llint_entry + 20278
48 JavaScriptCore
llint_entry + 20278
49 JavaScriptCore
llint_entry + 20278
50 JavaScriptCore
callToJavaScript + 334
51 JavaScriptCore
JSC::JITCode::execute(JSC::VM*, JSC::ProtoCallFrame*) + 36
52 JavaScriptCore
JSC::Interpreter::executeCall(JSC::ExecState*, JSC::JSObject*, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) + 350
53 JavaScriptCore
JSC::call(JSC::ExecState*, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) + 62
54 JavaScriptCore
JSC::boundFunctionCall(JSC::ExecState*) + 342
55 JavaScriptCore
callToNativeFunction + 318
56 JavaScriptCore
JSC::Interpreter::executeCall(JSC::ExecState*, JSC::JSObject*, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) + 418
57 JavaScriptCore
JSC::call(JSC::ExecState*, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&, JSC::JSValue*) + 64
58 WebCore
WebCore::JSEventListener::handleEvent(WebCore::ScriptExecutionContext*, WebCore::Event*) + 520
59 WebCore
WebCore::EventTarget::fireEventListeners(WebCore::Event*, WebCore::EventTargetData*, WTF::Vector<WebCore::RegisteredEventListener, 1ul, WTF::CrashOnOverflow>&) + 650
60 WebCore
WebCore::EventTarget::fireEventListeners(WebCore::Event*) + 162
61 WebCore
WebCore::EventContext::handleLocalEvents(WebCore::Event&) const + 60
62 WebCore
WebCore::EventDispatcher::dispatchEvent(WebCore::Node*, WTF::PassRefPtr<WebCore::Event>) + 692
63 WebCore
WebCore::Node::dispatchEvent(WTF::PassRefPtr<WebCore::Event>) + 20
64 WebCore
WebCore::Document::finishedParsing() + 92
65 WebCore
WebCore::HTMLDocumentParser::prepareToStopParsing() + 118
66 WebCore
non-virtual thunk to WebCore::HTMLDocumentParser::notifyFinished(WebCore::CachedResource*) + 72
67 WebCore
WebCore::CachedResource::checkNotify() + 58
68 WebCore
WebCore::SubresourceLoader::didFinishLoading(double) + 128
69 CFNetwork
___ZN27URLConnectionClient_Classic26_delegate_didFinishLoadingEU13block_pointerFvvE_block_invoke + 78
70 CFNetwork
___ZN27URLConnectionClient_Classic18_withDelegateAsyncEPKcU13block_pointerFvP16_CFURLConnectionPK33CFURLConnectionClientCurrent_VMaxE_block_invoke_2 + 60
71 CFNetwork
RunloopBlockContext::_invoke_block(void const*, void*) + 60
72 CoreFoundation
CFArrayApplyFunction + 36
73 CFNetwork
RunloopBlockContext::perform() + 182
74 CFNetwork
MultiplexerSource::perform() + 216
75 CFNetwork
MultiplexerSource::_perform(void*) + 48
76 CoreFoundation
__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
77 CoreFoundation
__CFRunLoopDoSources0 + 218
78 CoreFoundation
__CFRunLoopRun + 772
79 CoreFoundation
CFRunLoopRunSpecific + 476
80 CoreFoundation
CFRunLoopRunInMode + 106
81 WebCore
RunWebThread(void*) + 418
82 libsystem_pthread.dylib
_pthread_body + 138
83 libsystem_pthread.dylib
_pthread_start + 118
84
libsystem_pthread.dylib
thread_start + 8
以下是我的Banner View代码:
func bannerViewDidLoadAd(banner: ADBannerView!) {
log.PrintMe("bannerViewDidLoadAd")
admobBannerView.hidden = true
UIView.animateWithDuration(0.5) { () -> Void in
adBannerView.alpha = 1 //iAd Banner
}
}
func bannerViewActionDidFinish(banner: ADBannerView!) {
log.PrintMe("bannerViewActionDidFinish")
}
func bannerView(banner: ADBannerView!, didFailToReceiveAdWithError error: NSError!) {
log.PrintMe("didFailToReceiveAdWithError: \(error)")
UIView.animateWithDuration(0.5) { () -> Void in
adBannerView.alpha = 0 //iAd Banner
}
admobBannerView.hidden = false
}
func bannerViewActionShouldBegin(banner: ADBannerView!, willLeaveApplication willLeave: Bool) -> Bool {
return true
}