Forgot to say that the precondition failure happens when I scroll the list (perhaps an update issue?). I also noticed that the frame height setting has something to do with this. With ".frame(height: 100)" I can show 8 MapViews and get precondition failure with 9.
Post
Replies
Boosts
Views
Activity
It doesn't really show the stack properly (in source line level). This is the message "2019-12-02 20:41:30.752264+0200 MapKitTest[20750:6545087] precondition failure: invalid value type for attribute: 102". The thread 1 stops in "class AppDelegate: UIResponder, UIApplicationDelegate {" line in AppDelegate.swift. Before that the stack just shows some assembly "libdyld.dylib`start: 0x7fff51a1dc24 <+0>: nop -> 0x7fff51a1dc25 <+1>: movl %eax, %edi 0x7fff51a1dc27 <+3>: callq 0x7fff51a479c8 ; symbol stub for: exit 0x7fff51a1dc2c <+8>: hlt 0x7fff51a1dc2d <+9>: nop"...but perhaps there's a better way to analyze the stack? Let me know. Thanks!(I'm using iPhone simulators and real devices...same behaviour)
Xcode also shows this stack frame. This is just a simple test app (source shown above). I assume it is easy to reproduce.
Thanks Claude! So you were able to reproduce it. Excellent! I also noticed that I can create tens of MapViews if I remove the frame size definition...but the map is not very useful then. So I'm not sure what to try next.
Here's how to avoid it. Add VStack inside the List.List { VStack {.....//MapViews here }}Why? No idea... but that seems to help.
Thanks maxxfrazer,Actually I'm using SwiftUI. I tried to set the cube position as [0,0,-1]. See below.struct ContentView : View {
var body: some View {
return ARViewContainer().edgesIgnoringSafeArea(.all)
}
}
struct ARViewContainer: UIViewRepresentable {
func makeUIView(context: Context) -> ARView {
let arView = ARView(frame: .zero)
arView.cameraMode = .nonAR
let boxAnchor = try! Experience.loadBox()
arView.scene.anchors.append(boxAnchor)
boxAnchor.setPosition([0,0,-1], relativeTo: nil)
return arView
}
func updateUIView(_ uiView: ARView, context: Context) {}
}I also tried to use the other initializer for the ARView. See below.struct ARViewContainer: UIViewRepresentable {
func makeUIView(context: Context) -> ARView {
let frameRect = CGRect(x: 0, y: 0, width: 100, height: 100)
let cameraMode = ARView.CameraMode.nonAR
let arView = ARView(frame: frameRect, cameraMode: cameraMode, automaticallyConfigureSession: false)
let boxAnchor = try! Experience.loadBox()
arView.scene.anchors.append(boxAnchor)
boxAnchor.setPosition([0,0,-1], relativeTo: nil)
return arView
}
func updateUIView(_ uiView: ARView, context: Context) {}
}...but that did not help either (I'm not sure how to use the "frame"). Any ideas?
Excellent! Thanks maaxxfrazer!That works (I'm not using simulator).