- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 iOS 14 上使用 SwiftlySearch,在 iOS 15 上使用 .searchable。
struct CompatibleSearchBarModifier: ViewModifier {
@Binding var text: String
@ViewBuilder
func body(content: Content) -> some View {
if #available(iOS 15.0, *) {
content.searchable(text: self.$text, prompt: "Placeholder")
} else {
content.navigationBarSearch(self.$text, placeholder: "Placeholder", hidesSearchBarWhenScrolling: true, cancelClicked: {text = ""})
}
}
}
基于 Crashlytics,应用程序在 iOS 14.7.1-14.8 设备上崩溃。不幸的是,我无法在 Xcode 13.2.1 上重现该问题,因为我无法在模拟器上使用这些 iOS 版本(我试过这个库但没有成功:https://github.com/JinjunHan/iOSDeviceSupport)。在这种情况下我能做什么?
Crashed: com.apple.main-thread
0 libswiftCore.dylib 0x313dbc swift::ResolveAsSymbolicReference::operator()(swift::Demangle::__runtime::SymbolicReferenceKind, swift::Demangle::__runtime::Directness, int, void const*)
1 libswiftCore.dylib 0x33170c swift::Demangle::__runtime::Demangler::demangleSymbolicReference(unsigned char)
2 libswiftCore.dylib 0x32e970 swift::Demangle::__runtime::Demangler::demangleType(__swift::__runtime::llvm::StringRef, std::__1::function<swift::Demangle::__runtime::Node* (swift::Demangle::__runtime::SymbolicReferenceKind, swift::Demangle::__runtime::Directness, int, void const*)>)
3 libswiftCore.dylib 0x31935c swift_getTypeByMangledNameImpl(swift::MetadataRequest, __swift::__runtime::llvm::StringRef, void const* const*, std::__1::function<swift::TargetMetadata<swift::InProcess> const* (unsigned int, unsigned int)>, std::__1::function<swift::TargetWitnessTable<swift::InProcess> const* (swift::TargetMetadata<swift::InProcess> const*, unsigned int)>)
4 libswiftCore.dylib 0x316d58 swift::swift_getTypeByMangledName(swift::MetadataRequest, __swift::__runtime::llvm::StringRef, void const* const*, std::__1::function<swift::TargetMetadata<swift::InProcess> const* (unsigned int, unsigned int)>, std::__1::function<swift::TargetWitnessTable<swift::InProcess> const* (swift::TargetMetadata<swift::InProcess> const*, unsigned int)>)
5 libswiftCore.dylib 0x316f6c swift_getTypeByMangledNameInContext
6 Menetrend 0xb7b0 __swift_instantiateConcreteTypeFromMangledName + 4331173808 (<compiler-generated>:4331173808)
7 Menetrend 0x205750 CompatibleSearchBarModifier.body(content:) + 1107 (FavouritesView.swift:1107)
8 SwiftUI 0x60a160 partial apply for closure #1 in ModifierBodyAccessor.updateBody(of:changed:)
9 SwiftUI 0x62c364 closure #1 in BodyAccessor.setBody(_:)
10 SwiftUI 0x609a64 ModifierBodyAccessor.updateBody(of:changed:)
11 SwiftUI 0x62c770 DynamicBody.updateValue()
12 SwiftUI 0x32f764 partial apply for implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>(_:)
13 AttributeGraph 0x5108 AG::Graph::UpdateStack::update()
14 AttributeGraph 0x5518 AG::Graph::update_attribute(AG::data::ptr<AG::Node>, bool)
15 AttributeGraph 0xa718 AG::Graph::input_value_ref_slow(AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, AGSwiftMetadata const*, bool*, long)
16 AttributeGraph 0x1b3c0 AGGraphGetValue
17 SwiftUI 0x972c80 _ConditionalContent<>.ChildView.content.getter
18 SwiftUI 0x972e20 _ConditionalContent<>.ChildView.value.getter
19 SwiftUI 0x972f30 protocol witness for Rule.value.getter in conformance _ConditionalContent<A, B><>.ChildView
20 SwiftUI 0x23e6e0 implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>(_:)
21 AttributeGraph 0x5108 AG::Graph::UpdateStack::update()
22 AttributeGraph 0x5518 AG::Graph::update_attribute(AG::data::ptr<AG::Node>, bool)
23 AttributeGraph 0xa718 AG::Graph::input_value_ref_slow(AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, AGSwiftMetadata const*, bool*, long)
24 AttributeGraph 0x1b3c0 AGGraphGetValue
25 SwiftUI 0x62fec8 AnyViewList.updateValue()
26 SwiftUI 0x205f0c partial apply for specialized implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>(_:)
27 AttributeGraph 0x5108 AG::Graph::UpdateStack::update()
28 AttributeGraph 0x5518 AG::Graph::update_attribute(AG::data::ptr<AG::Node>, bool)
29 AttributeGraph 0xa718 AG::Graph::input_value_ref_slow(AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, AGSwiftMetadata const*, bool*, long)
30 AttributeGraph 0x1b3c0 AGGraphGetValue
31 SwiftUI 0x4661e8 DynamicLayoutViewAdaptor.updatedItems()
32 SwiftUI 0x4cac4 specialized DynamicContainerInfo.updateItems(disableTransitions:)
33 SwiftUI 0x4b854 specialized DynamicContainerInfo.updateValue()
34 SwiftUI 0x1c924c partial apply for specialized implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>(_:)
35 AttributeGraph 0x5108 AG::Graph::UpdateStack::update()
36 AttributeGraph 0x5518 AG::Graph::update_attribute(AG::data::ptr<AG::Node>, bool)
37 AttributeGraph 0xa718 AG::Graph::input_value_ref_slow(AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, AGSwiftMetadata const*, bool*, long)
38 AttributeGraph 0x1b3c0 AGGraphGetValue
39 SwiftUI 0x328b5c DynamicPreferenceCombiner.info.getter
40 SwiftUI 0x328d00 DynamicPreferenceCombiner.value.getter
41 SwiftUI 0x23e6e0 implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>(_:)
42 AttributeGraph 0x5108 AG::Graph::UpdateStack::update()
43 AttributeGraph 0x5518 AG::Graph::update_attribute(AG::data::ptr<AG::Node>, bool)
44 AttributeGraph 0xa718 AG::Graph::input_value_ref_slow(AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, AGSwiftMetadata const*, bool*, long)
45 AttributeGraph 0x1b3c0 AGGraphGetValue
46 SwiftUI 0x5d7510 HostPreferencesTransform.updateValue()
47 SwiftUI 0x32f764 partial apply for implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>(_:)
48 AttributeGraph 0x5108 AG::Graph::UpdateStack::update()
49 AttributeGraph 0x5518 AG::Graph::update_attribute(AG::data::ptr<AG::Node>, bool)
50 AttributeGraph 0xa718 AG::Graph::input_value_ref_slow(AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, AGSwiftMetadata const*, bool*, long)
51 AttributeGraph 0x1b3c0 AGGraphGetValue
52 SwiftUI 0x5d7510 HostPreferencesTransform.updateValue()
53 SwiftUI 0x32f764 partial apply for implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>(_:)
54 AttributeGraph 0x5108 AG::Graph::UpdateStack::update()
55 AttributeGraph 0x5518 AG::Graph::update_attribute(AG::data::ptr<AG::Node>, bool)
56 AttributeGraph 0xa718 AG::Graph::input_value_ref_slow(AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, AGSwiftMetadata const*, bool*, long)
57 AttributeGraph 0x1b3c0 AGGraphGetValue
58 SwiftUI 0x7e4d0 specialized HostPreferencesTransform.updateValue()
59 SwiftUI 0x1e4590 partial apply for specialized implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>(_:)
60 AttributeGraph 0x5108 AG::Graph::UpdateStack::update()
61 AttributeGraph 0x5518 AG::Graph::update_attribute(AG::data::ptr<AG::Node>, bool)
62 AttributeGraph 0xa1a8 AG::Graph::value_ref(AG::AttributeID, AGSwiftMetadata const*, bool*)
63 AttributeGraph 0x1b408 AGGraphGetValue
64 SwiftUI 0x8e9f38 GraphHost.preferenceValues()
65 SwiftUI 0x84fcec specialized GraphHost.preferenceValue<A>(_:)
66 SwiftUI 0x84aacc specialized ViewRendererHost.updateViewGraph<A>(body:)
67 SwiftUI 0x6463c specialized closure #1 in UINavigationController.update<A>(with:in:)
68 SwiftUI 0x45cf40 thunk for @escaping @callee_guaranteed () -> ()
69 SwiftUI 0x84ed74 closure #1 in ViewRendererHost.render(interval:updateDisplayList:)
70 SwiftUI 0x84ae68 ViewRendererHost.render(interval:updateDisplayList:)
71 SwiftUI 0x9a7654 _UIHostingView.layoutSubviews()
72 SwiftUI 0x9a7680 @objc _UIHostingView.layoutSubviews()
73 UIKitCore 0x102f8bc -[UIView(CALayerDelegate) layoutSublayersOfLayer:]
74 QuartzCore 0x15e424 -[CALayer layoutSublayers]
75 QuartzCore 0x164bac CA::Layer::layout_if_needed(CA::Transaction*)
76 QuartzCore 0x17016c CA::Layer::layout_and_display_if_needed(CA::Transaction*)
77 QuartzCore 0xb8578 CA::Context::commit_transaction(CA::Transaction*, double, double*)
78 QuartzCore 0xe32c8 CA::Transaction::commit()
79 UIKitCore 0xb4d8b0 __34-[UIApplication _firstCommitBlock]_block_invoke_2
80 CoreFoundation 0x9ad08 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__
81 CoreFoundation 0x99f9c __CFRunLoopDoBlocks
82 CoreFoundation 0x9472c __CFRunLoopRun
83 CoreFoundation 0x93ed0 CFRunLoopRunSpecific
84 GraphicsServices 0x3570 GSEventRunModal
85 UIKitCore 0xb302d0 -[UIApplication _run]
86 UIKitCore 0xb3584c UIApplicationMain
87 SwiftUI 0x881530 closure #1 in KitRendererCommon(_:)
88 SwiftUI 0x8814c0 runApp<A>(_:)
89 SwiftUI 0x432870 static App.main()
90 Menetrend 0x6cb8 main + 4331154616 (TripDetailsStop.swift:4331154616)
91 libdyld.dylib 0x1140 start
最佳答案
更新:这已在 XCode 13.3 上修复。请更新到那个版本。如果你不想更新,我会在下面留下我的答案。
我的应用程序也遇到了同样的问题,用户报告在 iOS 14 上随机崩溃,我的崩溃日志看起来与您的非常相似。帮助我找到解决方案的主线是 __swift_instantiateConcreteTypeFromMangledName
(它在您的崩溃报告的第 6 行和我的第 7 行)。
我的模拟器崩溃报告:
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libswiftCore.dylib 0x18eb3a0f0 swift::ResolveAsSymbolicReference::operator()(swift::Demangle::SymbolicReferenceKind, swift::Demangle::Directness, int, void const*) + 64
1 libswiftCore.dylib 0x18eb519ac swift::Demangle::Demangler::demangleSymbolicReference(unsigned char) + 200
2 libswiftCore.dylib 0x18eb519ac swift::Demangle::Demangler::demangleSymbolicReference(unsigned char) + 200
3 libswiftCore.dylib 0x18eb4eda0 swift::Demangle::Demangler::demangleType(llvm::StringRef, std::__1::function<swift::Demangle::Node* (swift::Demangle::SymbolicReferenceKind, swift::Demangle::Directness, int, void const*)>) + 184
4 libswiftCore.dylib 0x18eb3f158 swift_getTypeByMangledNameImpl(swift::MetadataRequest, llvm::StringRef, void const* const*, std::__1::function<swift::TargetMetadata<swift::InProcess> const* (unsigned int, unsigned int)>, std::__1::function<swift::TargetWitnessTable<swift::InProcess> const* (swift::TargetMetadata<swift::InProcess> const*, unsigned int)>) + 460
5 libswiftCore.dylib 0x18eb3cc88 swift::swift_getTypeByMangledName(swift::MetadataRequest, llvm::StringRef, void const* const*, std::__1::function<swift::TargetMetadata<swift::InProcess> const* (unsigned int, unsigned int)>, std::__1::function<swift::TargetWitnessTable<swift::InProcess> const* (swift::TargetMetadata<swift::InProcess> const*, unsigned int)>) + 540
6 libswiftCore.dylib 0x18eb3ce80 swift_getTypeByMangledNameInContext + 128
7 Asobi 0x1040bef40 __swift_instantiateConcreteTypeFromMangledName + 52
8 Asobi 0x1040c9eb0 thunk for @escaping @callee_guaranteed (@guaranteed Bookmark) -> (@out _ConditionalContent<AnyView, <<opaque return type of View.contextMenu<A>(menuItems:)>>.0>) + 8 [inlined]
9 Asobi 0x1040c9eb0 partial apply for thunk for @escaping @callee_guaranteed (@guaranteed Bookmark) -> (@out _ConditionalContent<AnyView, <<opaque return type of View.contextMenu<A>(menuItems:)>>.0>) + 24
10 SwiftUI 0x1b40abee8 ForEachChild.updateValue() + 852
11 SwiftUI 0x1b3c8bd5c partial apply for implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>(_:) + 28
12 AttributeGraph 0x1aa00b1f4 AG::Graph::UpdateStack::update() + 484
13 AttributeGraph 0x1aa00b5fc AG::Graph::update_attribute(AG::data::ptr<AG::Node>, bool) + 320
14 AttributeGraph 0x1aa010544 AG::Graph::input_value_ref_slow(AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, AGSwiftMetadata const*, bool*, long) + 380
15 AttributeGraph 0x1aa021210 AGGraphGetValue + 220
16 SwiftUI 0x1b426ab34 _ConditionalContent<>.ChildView.content.getter + 60
17 SwiftUI 0x1b426ac5c _ConditionalContent<>.ChildView.value.getter + 260
18 SwiftUI 0x1b426ad44 protocol witness for Rule.value.getter in conformance _ConditionalContent<A, B><>.ChildView + 40
19 SwiftUI 0x1b3a76728 implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>(_:) + 68
20 AttributeGraph 0x1aa00b1f4 AG::Graph::UpdateStack::update() + 484
21 AttributeGraph 0x1aa00b5fc AG::Graph::update_attribute(AG::data::ptr<AG::Node>, bool) + 320
22 AttributeGraph 0x1aa010544 AG::Graph::input_value_ref_slow(AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, AGSwiftMetadata const*, bool*, long) + 380
23 AttributeGraph 0x1aa021210 AGGraphGetValue + 220
24 SwiftUI 0x1b3f45b14 AnyViewList.updateValue() + 56
25 SwiftUI 0x1b3c2a9a8 partial apply for specialized implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>(_:) + 20
26 AttributeGraph 0x1aa00b1f4 AG::Graph::UpdateStack::update() + 484
27 AttributeGraph 0x1aa00b5fc AG::Graph::update_attribute(AG::data::ptr<AG::Node>, bool) + 320
28 AttributeGraph 0x1aa0104a8 AG::Graph::input_value_ref_slow(AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, AGSwiftMetadata const*, bool*, long) + 224
29 AttributeGraph 0x1aa021018 AGGraphGetInputValue + 268
30 SwiftUI 0x1b40a6e44 closure #1 in ForEachState.traitKeys.getter + 120
31 SwiftUI 0x1b40a729c ForEachState.forEachItem(from:style:do:) + 976
32 SwiftUI 0x1b40a6db8 ForEachState.traitKeys.getter + 52
33 SwiftUI 0x1b40ab6cc ForEachList.traitKeys.getter + 20
34 SwiftUI 0x1b4207b34 Sections.init(from:reifyEmptyHeaders:useFooters:) + 132
35 SwiftUI 0x1b3e02fb0 SystemListDataSource.init(_:style:minRowHeight:minHeaderHeight:) + 108
36 SwiftUI 0x1b4134278 InsettableGroupedListBody.Body.body.getter + 564
37 SwiftUI 0x1b3c72d7c partial apply for closure #1 in ViewBodyAccessor.updateBody(of:changed:) + 28
38 SwiftUI 0x1b3f41f88 closure #1 in BodyAccessor.setBody(_:) + 44
39 SwiftUI 0x1b3c6e0e4 ViewBodyAccessor.updateBody(of:changed:) + 1340
40 SwiftUI 0x1b3f42304 DynamicBody.updateValue() + 268
41 SwiftUI 0x1b3c8bd5c partial apply for implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>(_:) + 28
42 AttributeGraph 0x1aa00b1f4 AG::Graph::UpdateStack::update() + 484
43 AttributeGraph 0x1aa00b5fc AG::Graph::update_attribute(AG::data::ptr<AG::Node>, bool) + 320
44 AttributeGraph 0x1aa010544 AG::Graph::input_value_ref_slow(AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, AGSwiftMetadata const*, bool*, long) + 380
45 AttributeGraph 0x1aa021210 AGGraphGetValue + 220
46 SwiftUI 0x1b3e929e4 ListCore.Child.core.getter + 68
47 SwiftUI 0x1b3e92b1c ListCore.Child.value.getter + 268
48 SwiftUI 0x1b3a76728 implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>(_:) + 68
49 AttributeGraph 0x1aa00b1f4 AG::Graph::UpdateStack::update() + 484
50 AttributeGraph 0x1aa00b5fc AG::Graph::update_attribute(AG::data::ptr<AG::Node>, bool) + 320
51 AttributeGraph 0x1aa010544 AG::Graph::input_value_ref_slow(AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, AGSwiftMetadata const*, bool*, long) + 380
52 AttributeGraph 0x1aa021210 AGGraphGetValue + 220
53 SwiftUI 0x1b3f41a60 StaticBody.container.getter + 76
54 SwiftUI 0x1b3f42070 StaticBody.updateValue() + 116
55 SwiftUI 0x1b3c8bd5c partial apply for implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>(_:) + 28
56 AttributeGraph 0x1aa00b1f4 AG::Graph::UpdateStack::update() + 484
57 AttributeGraph 0x1aa00b5fc AG::Graph::update_attribute(AG::data::ptr<AG::Node>, bool) + 320
58 AttributeGraph 0x1aa010544 AG::Graph::input_value_ref_slow(AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, AGSwiftMetadata const*, bool*, long) + 380
59 AttributeGraph 0x1aa021210 AGGraphGetValue + 220
60 SwiftUI 0x1b3977568 specialized UnaryPositionAwareChildGeometry.layout.getter + 24
61 SwiftUI 0x1b3977648 specialized UnaryPositionAwareChildGeometry.value.getter + 112
62 SwiftUI 0x1b3a228d4 specialized implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>(_:) + 36
63 SwiftUI 0x1b3a3d15c partial apply for specialized implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>(_:) + 24
64 AttributeGraph 0x1aa00b1f4 AG::Graph::UpdateStack::update() + 484
65 AttributeGraph 0x1aa00b5fc AG::Graph::update_attribute(AG::data::ptr<AG::Node>, bool) + 320
66 AttributeGraph 0x1aa010544 AG::Graph::input_value_ref_slow(AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, AGSwiftMetadata const*, bool*, long) + 380
67 AttributeGraph 0x1aa021210 AGGraphGetValue + 220
68 SwiftUI 0x1b3a6a2e0 LayoutPositionQuery.localPosition.getter + 24
69 SwiftUI 0x1b3a6a34c LayoutPositionQuery.updateValue() + 36
70 SwiftUI 0x1b3c2aae4 partial apply for specialized implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>(_:) + 20
71 AttributeGraph 0x1aa00b1f4 AG::Graph::UpdateStack::update() + 484
72 AttributeGraph 0x1aa00b5fc AG::Graph::update_attribute(AG::data::ptr<AG::Node>, bool) + 320
73 AttributeGraph 0x1aa010544 AG::Graph::input_value_ref_slow(AG::data::ptr<AG::Node>, AG::AttributeID, unsigned int, AGSwiftMetadata const*, bool*, long) + 380
74 AttributeGraph 0x1aa021210 AGGraphGetValue + 220
75 SwiftUI 0x1b41833f0 AnimatableFrameAttribute.updateValue() + 52
76 SwiftUI 0x1b3c2b0dc partial apply for specialized implicit closure #2 in implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>(_:) + 20
77 AttributeGraph 0x1aa00b1f4 AG::Graph::UpdateStack::update() + 484
78 AttributeGraph 0x1aa00b5fc AG::Graph::update_attribute(AG::data::ptr<AG::Node>, bool) + 320
79 AttributeGraph 0x1aa013e60 AG::Subgraph::update(unsigned int) + 864
80 SwiftUI 0x1b41e66a0 GraphHost.runTransaction() + 164
81 SwiftUI 0x1b3d80790 ViewGraph.updateOutputs(at:) + 96
82 SwiftUI 0x1b4153d84 closure #1 in ViewRendererHost.render(interval:updateDisplayList:) + 1232
83 SwiftUI 0x1b414c45c ViewRendererHost.render(interval:updateDisplayList:) + 308
84 SwiftUI 0x1b429d934 _UIHostingView.layoutSubviews() + 168
85 SwiftUI 0x1b429d960 @objc _UIHostingView.layoutSubviews() + 24
86 UIKitCore 0x1848c603c -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2540
87 QuartzCore 0x1875fb374 -[CALayer layoutSublayers] + 288
88 QuartzCore 0x187601860 CA::Layer::layout_if_needed(CA::Transaction*) + 504
89 UIKitCore 0x1848b2b34 -[UIView(Hierarchy) layoutBelowIfNeeded] + 524
90 UIKitCore 0x183c132bc -[_UISheetPresentationController _sheetLayoutInfoLayout:] + 48
91 UIKitCore 0x183c0f6bc -[_UISheetLayoutInfo _layout] + 312
92 UIKitCore 0x183c150fc __54-[_UISheetPresentationController transitionWillBegin:]_block_invoke_2 + 52
93 UIKitCore 0x1848b9408 +[UIView(Animation) performWithoutAnimation:] + 96
94 UIKitCore 0x183c15030 __54-[_UISheetPresentationController transitionWillBegin:]_block_invoke.362 + 128
95 UIKitCore 0x183d391cc -[_UIViewControllerTransitionCoordinator _applyBlocks:releaseBlocks:] + 264
96 UIKitCore 0x183d35cbc -[_UIViewControllerTransitionContext __runAlongsideAnimations] + 256
97 UIKitCore 0x1848b91ec __63+[UIView(Animation) _setAlongsideAnimations:toRunByEndOfBlock:]_block_invoke + 28
98 UIKitCore 0x18488e748 -[UIViewAnimationState _runAlongsideAnimations] + 32
99 UIKitCore 0x18488d638 -[UIViewAnimationState pop] + 52
100 UIKitCore 0x18488adf8 +[UIViewAnimationState popAnimationState] + 64
101 UIKitCore 0x1848bab84 +[UIView _setupAnimationWithDuration:delay:view:options:factory:animations:start:animationStateGenerator:completion:] + 648
102 UIKitCore 0x1848baff8 +[UIView(UIViewAnimationWithBlocks) animateWithDuration:delay:options:animations:completion:] + 96
103 UIKitCore 0x184886940 __50-[UITransitionView _startTransition:withDuration:]_block_invoke.164 + 76
104 UIKitCore 0x1848bb4f4 +[UIView(UIViewAnimationWithBlocks) conditionallyAnimate:withAnimation:layout:completion:] + 88
105 UIKitCore 0x184886788 -[UITransitionView _startTransition:withDuration:] + 1156
106 UIKitCore 0x18488607c -[UITransitionView transition:fromView:toView:removeFromView:] + 2416
107 UIKitCore 0x183d31d34 -[UIViewControllerBuiltinTransitionViewAnimator animateTransition:] + 1476
108 UIKitCore 0x183d39dc8 ___UIViewControllerTransitioningRunCustomTransition_block_invoke_2 + 72
109 UIKitCore 0x183e66d6c +[UIInputResponderController _pinInputViewsForInputResponderController:onBehalfOfResponder:duringBlock:] + 104
110 UIKitCore 0x183d39d48 ___UIViewControllerTransitioningRunCustomTransition_block_invoke.641 + 176
111 UIKitCore 0x1848b90f0 +[UIView(Animation) _setAlongsideAnimations:toRunByEndOfBlock:] + 172
112 UIKitCore 0x183d39bb0 _UIViewControllerTransitioningRunCustomTransition + 580
113 UIKitCore 0x183c00b00 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke.466 + 2180
114 UIKitCore 0x184867084 -[_UIAfterCACommitBlock run] + 64
115 UIKitCore 0x1843d4728 _runAfterCACommitDeferredBlocks + 296
116 UIKitCore 0x1843c48e8 _cleanUpAfterCAFlushAndRunDeferredBlocks + 200
117 UIKitCore 0x1843f4cb4 _afterCACommitHandler + 76
118 CoreFoundation 0x180362190 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
119 CoreFoundation 0x18035c90c __CFRunLoopDoObservers + 556
120 CoreFoundation 0x18035ce7c __CFRunLoopRun + 992
121 CoreFoundation 0x18035c58c CFRunLoopRunSpecific + 572
122 GraphicsServices 0x18b634740 GSEventRunModal + 160
123 UIKitCore 0x1843c5cbc -[UIApplication _run] + 964
124 UIKitCore 0x1843caa9c UIApplicationMain + 112
125 SwiftUI 0x1b41859d8 closure #1 in KitRendererCommon(_:) + 108
126 SwiftUI 0x1b4185968 runApp<A>(_:) + 160
127 SwiftUI 0x1b3d7a890 static App.main() + 80
128 Asobi 0x1040be9cc static AsobiApp.$main() + 28 (AsobiApp.swift:10) [inlined]
129 Asobi 0x1040be9cc main + 40
130 dyld 0x104f150f4 start + 520
经过一些挖掘,我发现这个崩溃报告是由于 Xcode 13.2 和 13.2.1 上的 Swift 编译器中的一个错误。
论坛帖子:https://developer.apple.com/forums/thread/697070
这里的主要问题是,在发布版本中使用 #if available
(使用在您的情况下可搜索的任何 iOS 15 特定 API)会破坏 iOS 14 及以下版本的 SwiftUI 应用程序。 Apple 已意识到此错误,目前没有官方的解决方法。
论坛帖子中一些用户建议的解决方法是:
-Onone
我使用了 Github 链接中提供的解决方法,但如果您想使用 -Onone
路线,我在下面提供了说明。
如何设置-Onone
All
优化
Swift Compiler - Code Generation
下,将发布部分的 Optimization Level
设置为 -Onone
。如果您不想设置编译器选项,这是我对您的问题的解决方案,您将收到 Xcode 警告,但暂时忽略它:
struct CompatibleSearchBarModifier: ViewModifier {
@Binding var text: String
@ViewBuilder
func body(content: Content) -> some View {
if #available(iOS 15.0, *) {
Group {
if #available(iOS 15.0, *) {
content.searchable(text: self.$text, prompt: "Placeholder")
}
}
} else {
content.navigationBarSearch(self.$text, placeholder: "Placeholder", hidesSearchBarWhenScrolling: true, cancelClicked: {text = ""})
}
}
}
我建议向 Apple 发送反馈助理报告,以便他们可以仔细查看此错误。
我希望 Apple 在 Xcode 13.3 或其他 13.2.x 更新中修复此问题。
关于Swiftui 应用程序在 iOS 14/15 上因不同的 SearchBar (ViewModifier) 而崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70506330/
我是 C 语言新手,我编写了这个 C 程序,让用户输入一年中的某一天,作为返回,程序将输出月份以及该月的哪一天。该程序运行良好,但我现在想简化该程序。我知道我需要一个循环,但我不知道如何去做。这是程序
我一直在努力找出我的代码有什么问题。这个想法是创建一个小的画图程序,并有红色、绿色、蓝色和清除按钮。我有我能想到的一切让它工作,但无法弄清楚代码有什么问题。程序打开,然后立即关闭。 import ja
我想安装screen,但是接下来我应该做什么? $ brew search screen imgur-screenshot screen
我有一个在服务器端工作的 UDP 套接字应用程序。为了测试服务器端,我编写了一个简单的 python 客户端程序,它发送消息“hello world how are you”。服务器随后应接收消息,将
我有一个 shell 脚本,它运行一个 Python 程序来预处理一些数据,然后运行一个 R 程序来执行一些长时间运行的任务。我正在学习使用 Docker 并且我一直在运行 FROM r-base:l
在 Linux 中。我有一个 c 程序,它读取一个 2048 字节的文本文件作为输入。我想从 Python 脚本启动 c 程序。我希望 Python 脚本将文本字符串作为参数传递给 c 程序,而不是将
前言 最近开始整理笔记里的库存草稿,本文是 23 年 5 月创建的了(因为中途转移到 onedrive,可能还不止) 网页调起电脑程序是经常用到的场景,比如百度网盘下载,加入 QQ 群之类的 我
对于一个类,我被要求编写一个 VHDL 程序,该程序接受两个整数输入 A 和 B,并用 A+B 替换 A,用 A-B 替换 B。我编写了以下程序和测试平台。它完成了实现和行为语法检查,但它不会模拟。尽
module Algorithm where import System.Random import Data.Maybe import Data.List type Atom = String ty
我想找到两个以上数字的最小公倍数 求给定N个数的最小公倍数的C++程序 最佳答案 int lcm(int a, int b) { return (a/gcd(a,b))*b; } 对于gcd,请查看
这个程序有错误。谁能解决这个问题? Error is :TempRecord already defines a member called 'this' with the same paramete
当我运行下面的程序时,我在 str1 和 str2 中得到了垃圾值。所以 #include #include #include using namespace std; int main() {
这是我的作业: 一对刚出生的兔子(一公一母)被放在田里。兔子在一个月大时可以交配,因此在第二个月的月底,每对兔子都会生出两对新兔子,然后死去。 注:在第0个月,有0对兔子。第 1 个月,有 1 对兔子
我编写了一个程序,通过对字母使用 switch 命令将十进制字符串转换为十六进制,但是如果我使用 char,该程序无法正常工作!没有 switch 我无法处理 9 以上的数字。我希望你能理解我,因为我
我是 C++ 新手(虽然我有一些 C 语言经验)和 MySQL,我正在尝试制作一个从 MySQL 读取数据库的程序,我一直在关注这个 tutorial但当我尝试“构建”解决方案时出现错误。 (我正在使
仍然是一个初学者,只是尝试使用 swift 中的一些基本函数。 有人能告诉我这段代码有什么问题吗? import UIKit var guessInt: Int var randomNum = arc
我正在用 C++11 编写一个函数,它采用 constant1 + constant2 形式的表达式并将它们折叠起来。 constant1 和 constant2 存储在 std::string 中,
我用 C++ 编写了这段代码,使用运算符重载对 2 个矩阵进行加法和乘法运算。当我执行代码时,它会在第 57 行和第 59 行产生错误,非法结构操作(两行都出现相同的错误)。请解释我的错误。提前致谢:
我是 C++ 的初学者,我想编写一个简单的程序来交换字符串中的两个字符。 例如;我们输入这个字符串:“EXAMPLE”,我们给它交换这两个字符:“E”和“A”,输出应该类似于“AXEMPLA”。 我在
我需要以下代码的帮助: 声明 3 个 double 类型变量,每个代表三角形的三个边中的一个。 提示用户为第一面输入一个值,然后 将用户的输入设置为您创建的代表三角形第一条边的变量。 将最后 2 个步
我是一名优秀的程序员,十分优秀!