I hope to be able to display the USDA model in RealityComposerPro and play the Spatial Audio. I used RealityView to implement these contents:
RealityView{ content in
do {
let entity = try await Entity(named: "isWateringBasin", in: RealityKitContent.realityKitContentBundle)
content.add(entity)
guard let entity = entity.findEntity(named: "SpatialAudio"),
let resource = try? await AudioFileResource(named: "/Root/isWateringBasinAudio_m4a",
from: "isWateringBasin.usda",
in: RealityKitContent.realityKitContentBundle) else { return }
let audioPlaybackController = entity.prepareAudio(resource)
audioPlaybackController.play()
} catch {
print("Entity encountered an error while loading the model.")
return
}
}
but when I ran it, I found that although can displayed the model normally, Spatial Audio failed to play normally. I hope to get guidance, thank you!
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I didn't find any errors in my program, and Xcode didn't report any errors in the program code, but when I ran it, it inexplicably reported an error:
Command CompileAssetCatalog failed with a nonzero exit code
What should I do?
Topic:
Programming Languages
SubTopic:
Swift
Tags:
Swift
Xcode
Xcode Sanitizers and Runtime Issues
visionOS
Just now, we learned the exciting news that Vision Pro is about to be released! I would like to ask if there are any services such as discounts or rentals for developers? If so, can I experience it normally in China?
import SwiftUI
import TipKit
struct ChatRoomView: View {
@StateObject private var socketManager = SocketIOManager()
@State private var inputText: String = ""
@StateObject var viewModel = SignInWithAppleViewModel()
@Binding var isCall: Bool
@State private var isSheet = false
@State private var ShowView = false
var learnlisttip = KeyTip()
@Binding var showShareSheet: Bool
@Binding var codeshar: String
var body: some View {
NavigationStack{
VStack {
if let roomCode = socketManager.roomCode {
ZStack{
VStack{
HStack{
Text("Room Key: \(roomCode)")
.font(.title)
.onAppear{
codeshar = roomCode
self.isCall = true
}
Button(action:{
self.showShareSheet = true
}, label:{
Image(systemName: "square.and.arrow.up.fill")
.accessibilityLabel("Share")
})
}
.padding(20)
TipView(learnlisttip, arrowEdge: .top)
.glassBackgroundEffect()
.offset(z: 20)
Spacer()
}
List(socketManager.messages, id: \.self) { message in
Text(message)
}
TextField("input", text: $inputText)
Button("send") {
socketManager.sendMessage(roomCode: roomCode, message: inputText)
inputText = ""
}
}
.sheet(isPresented: $showShareSheet) {
let shareContent = "Open SpatialCall, Join this Room, Key is: \(codeshar)"
ActivityView(activityItems: [shareContent])
}
} else {
HStack{
Button(action:{
withAnimation{
socketManager.createRoom()
}
}, label: {
VStack{
Image(systemName: "phone.circle.fill")
.symbolRenderingMode(.multicolor)
.symbolEffect(.appear, isActive: !ShowView)
.font(.largeTitle)
Text("Add Room")
.font(.title3)
}
})
.buttonStyle(.borderless)
.buttonBorderShape(.roundedRectangle)
.padding(.horizontal, 30)
.glassBackgroundEffect()
.offset(z: 20)
.scaleEffect(1.5)
.padding(60)
Button(action:{
withAnimation{
self.isSheet = true
}
}, label: {
VStack{
Image(systemName: "phone.badge.checkmark")
.symbolRenderingMode(.multicolor)
.symbolEffect(.appear, isActive:!ShowView)
.font(.largeTitle)
Text("Join Room")
.font(.title3)
}
})
.buttonStyle(.borderless)
.buttonBorderShape(.roundedRectangle)
.padding(.horizontal, 30)
.glassBackgroundEffect()
.offset(z: 20)
.scaleEffect(1.5)
.padding(70)
}
}
}
.onAppear {
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
withAnimation {
self.ShowView = true
}
}
}
.sheet(isPresented: $isSheet){
VStack{
Text("Join Room")
.font(.largeTitle)
Text("You need to get the key to the room.")
TextField("Key", text: $inputText)
.padding(30)
.textFieldStyle(.roundedBorder)
Button(action:{
socketManager.joinRoom(roomCode: inputText)
self.isSheet = false
}, label: {
Text("Join Room")
.font(.title3)
})
.padding(50)
}
.padding()
}
.sheet(isPresented: $socketManager.showRoomNotFoundAlert) {
Text("The room does not exist. Please check whether the Key you entered is correct.")
.font(.title)
.frame(width: 500)
.padding()
Button(action:{
self.socketManager.showRoomNotFoundAlert = false
}, label: {
Text("OK")
.font(.title3)
})
.padding()
}
}
}
}
In the above code (this is a visionOS project), when I click Share, it can't display Sheet normally, and TipView can't be displayed either. Why?
In RealityView, I use AnchorEntity to lock to Wall to run normally:
AnchorEntity(.plane(.vertical, classification: .wall, minimumBounds: .one))
But I use a location other than wall but I can't display View. Why is that?
I found in App Store Connect that on the 18th (Vision Pro pre-sale day), my visionOS App was purchased by a person in the United States, but this day was only pre-sale. No one really got Vision Pro, and this app is only compatible with visionOS. May I ask why?
Topic:
Programming Languages
SubTopic:
Swift
Tags:
Swift
App Store Connect API
App Submission
visionOS
We can use AnchorEmpty to fix RealityView in one place, such as a wall. Now I hope that it can not only be fixed in one place, but also fill the whole place with RealityView by stretching. For example: My RealityView is a picture, which is now anchored to the wall, and ARKit will stretch the picture according to the size of the wall. How to achieve the whole wall? Thank you!
In order to improve App sales, I hope to promote App. At present, I only know from the VisionOS App Submission Guide that I can get the opportunity to become an editor's choice to promote the App by sharing my APP. Is there any other way to promote VisionOS App?
Topic:
App Store Distribution & Marketing
SubTopic:
App Store Connect API
Tags:
App Store Connect API
App Store Server Library
visionOS
I hope to send my income to my Apple Cash (Apple Cash can display the virtual card number in iOS 17.4 Beta). Is this okay?
If you can, how to fill in questions such as ABA Routeing Number in Agreements, Tax, and Banking? And will Apple Cash give me interest (I only have Apple Cash)
Topic:
App Store Distribution & Marketing
SubTopic:
App Store Connect
Tags:
Wallet
App Store Connect
Analytics & Reporting
How to display the user's own persona in a view
In Xcode16Beta4, it contains Predictive Code Completion, and Predictive Code Completion is also with other SDKs in the page opened by Xcode for the first time. Waiting for download.
However, I want to know: 1. What is Predictive Code Completion? 2. I didn't download Predictive Code Completion on the SDK download page when I first opened Xcode. Where should I download it later?
In a listing program in WWDC24, it shows that users can control the robot to walk by pinching and sliding. However, I haven't found any documents or videos related to this function. If you know, please let me know. Thank you!
I was making a gesture to let the goose (character) walk, but I had two problems.
1: I added collision and physical body components to the goose and the collided entity, but I found that those physical formations could not completely block the way of the goose. For example, a tree is in front of it. After the goose is blocked, it will cross the tree or run to the top of the tree as long as it is a little faster.
2: Because the knowledge I have accumulated is not very complete, I can control the movement of the goose on the z-axis. I hope that the user's gestures can be realized by dragging back and forth (z-axis), but I can only realize the user's gestures by dragging up and down (y-axis). I hope you can give me some guidance:
GooseOriginalPosition.z + Float(translation.height / 10000)
This is the complete code:
@State var goose: Entity?
@State var isDraggingGoose = false
@State var gooseOriginalPosition = SIMD3<Float>(repeating: 0)
RealityView { content in
if let model = try? await Entity(named: "WorldScene", in: realityKitContentBundle) {
content.add(model)
}
if let gooseEntity = try? await Entity(named: "Goose", in: realityKitContentBundle) {
gooseEntity.scale = SIMD3<Float>(repeating: 0.3)
content.add(gooseEntity)
goose = gooseEntity
}
}
.simultaneousGesture(DragGesture()
.targetedToAnyEntity()
.onChanged { value in
handleDrag(value)
}
.onEnded { _ in
isDraggingGoose = false
gooseTimer?.invalidate()
})
func handleDrag(_ value: EntityTargetValue<DragGesture.Value>) {
guard let goose = goose else { return }
if !isDraggingGoose {
isDraggingGoose = true
gooseOriginalPosition = goose.position(relativeTo: nil)
}
let translation = value.gestureValue.translation
let newPosition = SIMD3<Float>(
gooseOriginalPosition.x + Float(translation.width / 10000),
gooseOriginalPosition.y,
gooseOriginalPosition.z + Float(translation.height / 10000)//I hope the gesture here should be z-axis drag.
)
goose.setPosition(newPosition, relativeTo: nil)
}
During testing, I encountered an issue with SharePlay. Since SharePlay necessitates multi-device testing, I intend to use my Mac and Vision Pro for testing. However, since these two devices are also my primary devices, I am reluctant to switch Apple IDs for testing purposes. Instead, I would like to test the original Apple ID. However, since both devices belong to the same Apple ID and rely on the same phone number, they are unable to FaceTime each other. I am at a loss as to how to proceed.
I am honored that I successfully participated in the "Envision the future: Build great apps for visionOS"(https://developer.apple.com/events/view/ZCH7ZUY24C/dashboard) conference. However, unfortunately, I am in China, and due to the visa problem (because it usually takes at least 2 months to apply for a visa, but it only takes about 10 days from the time I received the notice to the meeting), I can't go to the United States to participate in the site. So I hope Apple can place an iPad on site and create a FaceTime link, and then I can make a call to this iPad. I also told Apple about this suggestion, but now there are only a few days left to start. They didn't reply to me. Even Apple has sent me the ticket to the Developer Center and asked me to add it to the Apple Wallet App, which means that Apple has not There is a request to deal with me. So I hope you can give me some advice or help me for those who know about this aspect. For Apple's internal engineers, if possible, I hope you can contact the person who manages this meeting. I'm very grateful for this. Thank you.