iOS 16.2: Cannot load underlying module for 'ARKit'

I have a strange warning in Xcode associated with ARKit. It isn't a big issue because there is a work around, but I am curious why this is happening and how I can avoid it in the future.

I opened up an old AR project in Xcode, and the editor gave a strange error message on the "import ARKit" line saying

Cannot load underlying module for 'ARKit'

Despite the error message, the code continues to build and run.

I've quit & restarted Xcode, rebooted the Mac, and even deleted and and redownloaded Xcode, but the error/warning was still there.

Upon some additional testing, I discovered that I only get this message when targeting "iOS 16.2" but not when targeting 16.0, 16.1, 16.3, or 16.4. (I did not try pre-iOS 16)

Any idea why my Xcode no longer likes ARKit on iOS 16.2 on my Mac?

Development platform:

  • Xcode: Version 14.3.1 (14E300c)
  • macOS: 13.4 (22F66)
  • Mac: Mac Studio 2022
  • iOS on iPhone 14 Pro Max: 16.5 (20F66)

Screenshot:

Just bumping this up in part because I ran into this problem again, but this time when I was trying to find the underlying problem with <<error type>> issue in a SwiftUI coordinator.

I started a new project today beginning with "Augmented Reality App" template, and now I get this ARKit error with iOS 16.4 but not iOS 16.2 (or any other iOS minimum deployment). Sometimes I feel like Apple is gaslighting me. :-)

This issue also prevents Xcode from knowing a variable's type, showing <<error type>> (see screenshot below), which causes additional problems. (Again, all problems go away when I target a different minimum deployment target)

Values for "Minimum Deployments" value where I get the error and where I do not.

  • iOS 16.4 - error
  • iOS 16.3 - NO error
  • iOS 16.2 - NO error

I can replicate the error by creating a new iOS project with the template "Augmented Reality App", and then simply add "import ARKit" to the group of imports.

In this example with minimum deployment set to iOS 16.4, Xcode doesn't know what type foo is. It shows <<error type>>

But when I change the minimum deployment type to iOS 16.3, Xcode knows foo is of type PerspectiveCamera.

I have the same problem. Why?

iOS 16.2: Cannot load underlying module for 'ARKit'
 
 
Q