Thanks for being a part of WWDC25!

How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here

Specific ARKit node not showing in AR

After two types of objects correctly inserted as nodes in an augmented reality setting, I replicated exactly the same procedure with a third kind of objects that unfortunately refuse to show up. I checked the flow and it is the same as the other objects as well the content of the LocationAnnotation, but there is surely something that escapes me. Could someone help with some ideas?

This is the common code, apart of the class:

func appendInAR(ghostElement: Ghost){
        let ghostElementAnnotationLocation=GhostLocationAnnotationNode(ghost: ghostElement)
        
        ghostElementAnnotationLocation.scaleRelativeToDistance = true
        sceneLocationView.addLocationNodeWithConfirmedLocation(locationNode: ghostElementAnnotationLocation)
        shownGhostsAnnotations.append(ghostElementAnnotationLocation)
    }

Hello @fbartolom,

I recommend that you apply some of the debugging techniques described in TN3124: Debugging coordinate space issues.

-- Greg

The example you quoted regards SwiftUI, while I simply use Swift. Which part should I consider to enable debugging, given the ordinary debug window seems not to work? Moreover sceneLocationView.debugOptions.insert(.showAnchorOrigins) says "Type 'SCNDebugOptions.Element' (aka 'SCNDebugOptions') has no member 'showAnchorOrigins'"

Also, after having inserted:

        sceneLocationView.debugOptions.insert(.showBoundingBoxes)
        sceneLocationView.debugOptions.insert(.showCameras)

nothing seems to happen, while SCNScene remains always grayed out

I do not know if that has something to do with the not-showing LocationAnnotations, but I receive a long list of warnings of this kind:

nw_endpoint_flow_failed_with_error [C9.2.1 82.223.15.117:443 in_progress channel-flow (satisfied (Path is satisfied), viable, interface: en0[802.11], ipv4, dns, uses wifi)] already failing, returning
nw_endpoint_flow_failed_with_error [C9.2.1 82.223.15.117:443 cancelled channel-flow ((null))] already failing, returning
tcp_output [C8.5.1:3] flags=[R.] seq=3916721535, ack=3417376628, win=2059 state=CLOSED rcv_nxt=3417376628, snd_una=3916721535
nw_endpoint_flow_failed_with_error [C8.5.1 82.223.15.117:443 in_progress channel-flow (satisfied (Path is satisfied), viable, interface: en0[802.11], ipv4, dns, uses wifi)] already failing, returning
nw_endpoint_flow_failed_with_error [C8.5.1 82.223.15.117:443 cancelled channel-flow ((null))] already failing, returning
tcp_output [C9.3.1:3] flags=[R.] seq=3809671418, ack=2489189421, win=2059 state=CLOSED rcv_nxt=2489189421, snd_una=3809671418
nw_endpoint_flow_failed_with_error [C9.3.1 82.223.15.117:443 in_progress channel-flow (satisfied (Path is satisfied), viable, interface: en0[802.11], ipv4, dns, uses wifi)] already failing, returning
nw_endpoint_flow_failed_with_error [C9.3.1 82.223.15.117:443 cancelled channel-flow ((null))] already failing, returning
tcp_output [C8.6.1:3] flags=[R.] seq=2844966683, ack=2314191636, win=2059 state=CLOSED rcv_nxt=2314191636, snd_una=2844966683
nw_endpoint_flow_failed_with_error [C8.6.1 82.223.15.117:443 in_progress channel-flow (satisfied (Path is satisfied), viable, interface: en0[802.11], ipv4, dns, uses wifi)] already failing, returning
nw_endpoint_flow_failed_with_error [C8.6.1 82.223.15.117:443 cancelled channel-flow ((null))] already failing, returning
nw_path_necp_check_for_updates Failed to copy updated result (22)
tcp_output [C9.4.1:3] flags=[R.] seq=309905021, ack=2932137234, win=2059 state=CLOSED rcv_nxt=2932137234, snd_una=309905021
nw_endpoint_flow_failed_with_error [C9.4.1 82.223.15.117:443 in_progress channel-flow (satisfied (Path is satisfied), viable, interface: en0[802.11], ipv4, dns, uses wifi)] already failing, returning
nw_endpoint_flow_failed_with_error [C9.4.1 82.223.15.117:443 cancelled channel-flow ((null))] already failing, returning
tcp_output [C8.7.1:3] flags=[R.] seq=3578401679, ack=3456334273, win=2059 state=CLOSED rcv_nxt=3456334273, snd_una=3578401679
nw_endpoint_flow_failed_with_error [C8.7.1 82.223.15.117:443 in_progress channel-flow (satisfied (Path is satisfied), viable, interface: en0[802.11], ipv4, dns, uses wifi)] already failing, returning
nw_endpoint_flow_failed_with_error [C8.7.1 82.223.15.117:443 cancelled channel-flow ((null))] already failing, returning

Also a previously shown kind of annotations do not show any longer, differently of what I wrote in the optimistic initial post.

Hello @fbartolom,

The technote I cited contains general debugging strategies, it used SwiftUI only as an example.

To debug this issue, I recommend that you take the steps described in the following sections:

-- Greg

In fact I added

sceneLocationView.debugOptions.insert(.showWorldOrigin)
    sceneLocationView.debugOptions.insert(.showBoundingBoxes)
        sceneLocationView.debugOptions.insert(.showCameras)

as suggested in the article, but nothing seems to change or be shown different anywhere.

As for the Log transforms and bounding boxes, my problem is not that the annotations are misplaced, rather than they do not show up in the screen, even rotating the iPhone in all directions.

Finally as for the focused example, as already said, the same code correctly displays a kind of LocationAnnotations, but not other ones.

I found that in the not showing LocationAnnotations sceneNode in SceneLocationView is nil, but I have no idea why it turns to that value.

At any rate I implemented a workaround by passing the SCNNode by:

func addNode(annotationLocation: ARCL.LocationAnnotationNode) {
        if let sceneNode=sceneLocationView.sceneNode {
            sceneLocationView.addLocationNodeWithConfirmedLocation(locationNode: annotationLocation, sceneNode: sceneNode)
        } else {
            let completion: ((SCNNode)->Void)={(sceneNode) in
                DispatchQueue.main.async {
                    print("sceneNode" + (sceneNode.description))
                    self.sceneLocationView.addLocationNodeWithConfirmedLocation(locationNode: annotationLocation, sceneNode:sceneNode)
                    self.sceneLocationView.focusItems(in: annotationLocation.frame)
                }
            }
            let nodeComposition = NamedSceneNode(sceneNodeCompletion: completion)
            nodeComposition.progress()
            print("count \(nodeComposition.counter)")
            if var viewController=UIApplication.topViewController() as? ViewControllerProtocol{
                if !viewController.nodeShowingCompletions.contains(nodeComposition){
                    viewController.nodeShowingCompletions.insert(
                        nodeComposition
                    )
                }
                
            }
        }
    }

By processing the completions when a SCNNode is ready in:

func sceneLocationViewDidUpdateLocationAndScaleOfLocationNode(sceneLocationView: SceneLocationView, locationNode: LocationNode) {
        guard let sceneNode=sceneLocationView.sceneNode else {
            return
        }
        //print("updated element"+locationNode.description + "sceneNode: " + (sceneLocationView.sceneNode?.description ?? "nil"))
        if let nodeCompletion = self.nodeShowingCompletions.first{
            nodeCompletion.sceneNodeCompletion(sceneNode)
            self.nodeShowingCompletions.remove(nodeCompletion)
        }
    }

Of course until Apple clarifies how to have the node to not nil in other classes respect to the first one.

Specific ARKit node not showing in AR
 
 
Q