I am using SwiftlySearch on iOS 14 and .searchable on iOS 15.
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 = ""})
}
}
}
The app crashes on iOS 14.7.1-14.8 devices based on Crashlytics. Unfortunately, I can't reproduce the problem on Xcode 13.2.1 since I can't use these iOS versions on the simulator (I tried this library without any success: https://github.com/JinjunHan/iOSDeviceSupport). Any ideas what could I do in this situation?
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