Object Capture App Error

I've been trying to run the Object Capture App under my M1 MacBook pro, macOS 12 beta, Xcode13 beta, and I got this Swift Compiler error code:

/Users/heyuanhuang/Downloads/CreatingAPhotogrammetryCommandLineApp 2/HelloPhotogrammetry/main.swift:39:46: 'SampleOverlap' is not a member type of struct 'HelloPhotogrammetry.Configuration' (aka 'PhotogrammetrySession.Configuration')

/Users/heyuanhuang/Downloads/CreatingAPhotogrammetryCommandLineApp 2/HelloPhotogrammetry/main.swift:19:8: Type 'HelloPhotogrammetry' does not conform to protocol 'Decodable'

/Users/heyuanhuang/Downloads/CreatingAPhotogrammetryCommandLineApp 2/HelloPhotogrammetry/main.swift:191:47: 'SampleOverlap' is not a member type of struct 'RealityFoundation.PhotogrammetrySession.Configuration'

Any help would be very much appreciated!

Answered by DTS Engineer in 681137022

Hello,

A new version of the sample project is available at https://developer.apple.com/documentation/realitykit/creating_a_photogrammetry_command-line_app

You can re-download the sample project to get the new version, which contains fixes for the build errors on beta 2.

Accepted Answer

I got it to work with first Xcode 13 beta 1 / Mac OS 12.0 Beta 1.

Just updated to latest Xcode beta and I get same error as you. :-(

It was pretty cool what it could do. I would run the HelloPhotogrammetry executable I made already but somehow the OS thinks it is malware cause it has an old cert... So I have to rebuild.

I was able to build and run the project using Xcode 13, Beta 2 (13A5155e), after installing macOS Monterey Beta 2 (21A5268h). There were some modifications needed to the Creating a Photogrammetry Command-Line App, as it appears the PhotogrammetrySession framework has had some changes between macOS 12 Beta 1 and Beta 2. I made the following changes;

  • I removed lines 35-39 in main.swift. It appears that the sampleOverlap property of PhotogrammetrySession.Configuration has been removed. Removing lines 35-39 resolves the HelloPhotogrammetry struct conformance errors.
  • It appears the PhotogrammetrySession.Output property has been removed, replacing the built-in Combine publisher with an ASyncInterator. This was alluded to in the WWDC21-10076 session, but I replaced the Combine publisher (lines 69-103) in main.swift with the following;
Task.init(priority: .default) {
	do {
		for try await output in session.outputs {
			switch output {
			case .requestProgress(let request, fractionComplete: let fraction):
				handleRequestProgress(request: request, fractionComplete: fraction)
			case .requestComplete(let request, let result):
				handleRequestComplete(request: request, result: result)
			case .requestError(let request, let error):
				print("Request \(String(describing: request)) had an error: \(String(describing: error))")
			case .processingComplete:
				// All requests are done so you can safely exit.
				print("Processing is complete!")
				Foundation.exit(0)
			case .inputComplete:  // Data ingestion has finished.
				print("Data ingestion is complete.  Beginning processing...")
			case .invalidSample(let id, let reason):
				print("Invalid Sample! id=\(id)  reason=\"\(reason)\"")
			case .skippedSample(let id):
				print("Sample id=\(id) was skipped by processing.")
			case .automaticDownsampling:
				print("Automatic downsampling was applied!")
			default:
				print("Output: unhandled message: \(output.localizedDescription)")
			}
		}
	}
}

Because of this change, I also removed subscriptions property from withExtendedLifetime (just below the session output code), which should change the call from withExtendedLifetime((session, subscriptions)) to withExtendedLifetime(session).

TLDR; Remove the sampleOverlap property from main.swift and change the session.output, which was a Combine publisher, to session.outputs, then iterate over the AsyncIterator, as was demoed in the WWDC21-10076 session. If you have Xcode 13 Beta 2 and macOS Monterey Beta 2 installed, this should now run as expected.

Thanks for all of your comments. I’m sorry if the specific line numbers did not align with the sample project. If anyone is still having difficulty adapting the sample project, I hope the linked code might help (it exceeded the character count to post here).

To note, it is imperative that your machine is running macOS Monterey Beta 2. As far as I can tell, the Photogrammetry API had modifications that are included in Monterey Beta 2 (and likely above) only. Even though Xcode 13 Beta 2 (and likely above) is aware of those changes, they are only functional with macOS Monterey Beta 2 (and likely above). This is presumably why @rickrl is facing the error detailed; the PhotogrammetrySession.Outputs Does not exist in macOS Monterey Beta 1.

I've posted my updated main.swift on this Gist. I am not sure if Apple allows linking to outside sources, but hoping that helps. I've tried to comment the code to indicate where changes took place and what those changes were.

Hello,

A new version of the sample project is available at https://developer.apple.com/documentation/realitykit/creating_a_photogrammetry_command-line_app

You can re-download the sample project to get the new version, which contains fixes for the build errors on beta 2.

I downloaded the latest version that @gchiste added. I get "Thread 1: breakpoint 1.1". What to do about it? Thank you

Having a new error: 'Task' cannot be constructed because it has no accessible initializers

Setup: Mac mini M1, Monterey 12.0 Beta(21A5284e) and Xcode 13.0 Beta(13A5154h). Used to work with Monterey first beta. I changed to Monterey Public Release Beta and the error is above. Not familiar with Swift, still learning, any quick advice to get this bug out? Thanks!

I am guessing that the Task is used for future version of Swift. If I change the Task to async, ie. let waiter = async { New error for session.outputs Value of type 'PhotogrammetrySession' has no member 'outputs'

Found a solution: Upgrade Xcode Version 13.0 beta 3 (13A5192j), and the problem solved.

Task is used for Swift 5.5 and above.

Object Capture App Error
 
 
Q