Hi everyone,
frome time to time I see crash which Im not able to debug, because there is no line of my code where crash occured.
This is a crash log what Im getting from time to time of some users. In my device I never get this kind of crash.
0 libswiftCore.dylib 0x1172c _assertionFailure(_:_:flags:) + 208
1 libswiftCore.dylib 0x198624 KEY_TYPE_OF_DICTIONARY_VIOLATES_HASHABLE_REQUIREMENTS(_:) + 2980
2 libswiftCore.dylib 0xdb6c8 specialized _NativeDictionary.uncheckedRemove(at:isUnique:) + 534
3 libswiftCore.dylib 0xb250c Dictionary._Variant.setValue(_:forKey:) + 204
4 libswiftCore.dylib 0x5a620 Dictionary.subscript.setter + 520
5 SwiftUICore 0xf62ec ForEachState.item(at:offset:) + 4340
6 SwiftUICore 0xf5054 ForEachState.forEachItem(from:style:do:) + 1796
7 SwiftUICore 0x2272f8 ForEachState.traitKeys.getter + 84
8 SwiftUICore 0x227298 ForEachList.traitKeys.getter + 24
9 SwiftUICore 0x227008 protocol witness for ViewList.traitKeys.getter in conformance SubgraphList + 76
10 SwiftUICore 0x227008 protocol witness for ViewList.traitKeys.getter in conformance SubgraphList + 76
11 SwiftUICore 0x227008 protocol witness for ViewList.traitKeys.getter in conformance SubgraphList + 76
12 SwiftUICore 0x227008 protocol witness for ViewList.traitKeys.getter in conformance SubgraphList + 76
13 SwiftUICore 0x2271fc DynamicViewList.WrappedList.traitKeys.getter + 88
27 SwiftUICore 0x226d18 specialized static SectionAccumulator.processUnsectionedContent(list:contentSubgraph:) + 84
28 SwiftUI 0x26afe0 ListSectionInfo.init(list:listAttribute:contentSubgraph:) + 132
29 SwiftUI 0x269bb0 UpdateCollectionViewListCoordinator.updateValue() + 1528
30 SwiftUI 0x785d4 partial apply for implicit closure #1 in closure #1 in closure #1 in Attribute.init<A>(_:) + 32
31 AttributeGraph 0xccac AG::Graph::UpdateStack::update() + 540
32 AttributeGraph 0xc870 AG::Graph::update_attribute(AG::data::ptr<AG::Node>, unsigned int) + 424
33 AttributeGraph 0xc444 AG::Subgraph::update(unsigned int) + 848
34 SwiftUICore 0x805a8 GraphHost.flushTransactions() + 860
35 SwiftUI 0x1ac84 closure #1 in _UIHostingView._renderForTest(interval:) + 24
36 SwiftUICore 0x7ffa8 partial apply for closure #1 in ViewGraphDelegate.updateGraph<A>(body:) + 28
37 SwiftUICore 0x7fd6c ViewRendererHost.updateViewGraph<A>(body:) + 120
38 SwiftUICore 0x7fce8 ViewGraphDelegate.updateGraph<A>(body:) + 84
39 SwiftUI 0x3e688 closure #1 in closure #1 in closure #1 in _UIHostingView.beginTransaction() + 172
40 SwiftUI 0x3e5d4 partial apply for closure #1 in closure #1 in closure #1 in _UIHostingView.beginTransaction() + 24
41 SwiftUICore 0x79720 closure #1 in static Update.ensure<A>(_:) + 56
42 SwiftUICore 0x796a4 static Update.ensure<A>(_:) + 100
43 SwiftUI 0x9c808 partial apply for closure #1 in closure #1 in _UIHostingView.beginTransaction() + 80
44 SwiftUICore 0x7f5e0 thunk for @callee_guaranteed () -> () + 28
45 SwiftUICore 0x6161c specialized closure #1 in static NSRunLoop.addObserver(_:) + 144
46 CoreFoundation 0x218a4 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 36
47 CoreFoundation 0x213f8 __CFRunLoopDoObservers + 552
48 CoreFoundation 0x75da8 __CFRunLoopRun + 948
49 CoreFoundation 0xc8284 CFRunLoopRunSpecific + 588
50 GraphicsServices 0x14c0 GSEventRunModal + 164
51 UIKitCore 0x3ee674 -[UIApplication _run] + 816
52 UIKitCore 0x14e88 UIApplicationMain + 340
53 SwiftUI 0x291ef8 closure #1 in KitRendererCommon(_:) + 168
54 SwiftUI 0x291e28 runApp<A>(_:) + 100
55 SwiftUI 0x291d0c static App.main() + 180
56 DholRainbow 0x3019e8 main + 4339145192 (DholRainbowApp.swift:4339145192)
57 ??? 0x1b0bf5de8 (Missing)
From Crashlytics I know at least human readable format of this error
Fatal error: Duplicate keys of type 'Contact' were found in a Dictionary. This usually means either that the type violates Hashable's requirements, or that members of such a dictionary were mutated after insertion.
I 've checked all my parts of code where Im using dictionary. This is a function which creating that particulary dictionary.
private func logsByDate() {
let groupedByDate = Dictionary(grouping: logs.filter { ($0.remoteParty as? Contact != nil) } ) {
$0.date.removeTimeStamp ?? .distantPast }.mapValues {
$0.compactMap { $0 }
}
var dayLogs = [DayLog]()
for date in groupedByDate {
var contacts = [CallLogContact]()
for log in logs.filter({ $0.date.removeTimeStamp ?? .distantPast == date.key }) {
if let contact = log.remoteParty as? Contact {
if contacts.firstIndex(where: {$0.contact == contact }) == nil {
let contactDayLogs = logs.filter({ $0.remoteParty as? Contact == contact && $0.date.removeTimeStamp == date.key})
contacts.append(
CallLogContact(
contact: contact,
logs: contactDayLogs,
lastCallLogDate: contactDayLogs.sorted(by: {$0.date > $1.date}).first?.date ?? .distantPast
)
)
}
}
}
dayLogs.append(DayLog(date: date.key, contact: contacts))
}
DispatchQueue.main.async {
self.groupedCallLogs = dayLogs
}
}
This function is called from 3 others functions based on notification from the server in case of new call log, fetched call logs and removed call logs.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hello,
Im not able to get any 3d object visible in ARView.
struct ARViewContainer: UIViewRepresentable {
var trackingState: ARCamera.TrackingState? = nil
func makeUIView(context: Context) -> ARView {
// Create the view.
let view = ARView(frame: .zero)
// Set the coordinator as the session delegate.
view.session.delegate = context.coordinator
let anchor = AnchorEntity(plane: .horizontal)
let box = ModelEntity(mesh: MeshResource.generateBox(size: 0.3), materials: [SimpleMaterial(color: .red, isMetallic: true)])
box.generateCollisionShapes(recursive: true)
anchor.addChild(box)
view.scene.addAnchor(anchor)
// Return the view.
return view
}
final class Coordinator: NSObject, ARSessionDelegate {
var parent: ARViewContainer
init(_ parent: ARViewContainer) {
self.parent = parent
}
func session(_ session: ARSession, cameraDidChangeTrackingState camera: ARCamera) {
print("Camera tracking state: \(camera.trackingState)")
parent.trackingState = camera.trackingState
}
}
func makeCoordinator() -> Coordinator {
Coordinator(self)
}
func updateUIView(_ uiView: ARView, context: Context) { }
}
View is loaded correctly but anything cant appear. I also tried to create 3D object in
func updateUIView(_ uiView: ARView, context: Context) {
let anchor = AnchorEntity(plane: .horizontal)
let box = ModelEntity(mesh: MeshResource.generateBox(size: 0.3), materials: [SimpleMaterial(color: .red, isMetallic: true)])
box.generateCollisionShapes(recursive: true)
anchor.addChild(box)
uiView.scene.addAnchor(anchor)
print("Added into the view")
}
Print statement is printed but there is still no object in the ARView. Is it bug or what am I missing?
UiTabBar.appearance().isHidden = true seems that has no effect anymore.
Is it bug or there is another way how to do it in iOS 16?
On iOS < 16 when I call at init
UiTabBar.appearance().isHidden = true default style is hidden.
I used this modifier when I had on TabBar more than 5 items. So I was able to hide more button at the TabBar and also in navigationBar edit. But now more button and edit button are always visible.