Post

Replies

Boosts

Views

Activity

Error processing request from MAD on result: Error Domain=NSOSStatusErrorDomain
New after update to Xcode 15: Error processing request from MAD on result: Error Domain=NSOSStatusErrorDomain Code=-128 "Request was canceled" Here is my code which I call within my GameViewController's viewDidLoad(). present(itsPlayerController!, animated:true) { self.itsMoviePlayer?.play() self.itsMovieIsFinished = false } Here is my code which I call at various times via playMovie(movieName: "pose"): func playMovie(movieName: String) { NotificationCenter.default.addObserver(self, selector: #selector(playerDidFinishPlaying), name: NSNotification.Name.AVPlayerItemDidPlayToEndTime, object: itsPlayerController?.player?.currentItem) present(itsPlayerController!, animated:true) { self.itsMoviePlayer?.play() self.itsMovieIsFinished = false } } // playMovie @objc func playerDidFinishPlaying(note: NSNotification) { self.itsPlayerController?.dismiss(animated:false, completion:nil) nextScene() changeScene() // re-init for next time setupMovie(theMovieName: "pose") } NB: If I do not call playMovie ==> NO ERROR THE PROBLEM = my call to present within playMovie. If I totally comment out present, = NO ERROR If I comment out just the guts of present, other errors are introduced. I have checked the syntax of calling present and I don't see any error there. All the above pertains to the Destination = iPad Mini (6th Generation If the Destination = Apple TV, then we get within GameViewDidLoad Unable to simultaneously satisfy constraints. For both Destinations, the Game runs OK - it's just these Warnings?? HAALP
3
0
2.0k
Sep ’23
UIBezierPath *not* showing?
I am developing a game in which my Locomotive is following a UIBezierPath that mimics an oval shaped Track. The math of the following is not "adding up" .. if it is, I am obviously not understanding the math of the layout. Bottom line = the following code does not display the UIBezierPath. Here's the code that creates this UIBezierPath .. please note the math in the comments: func createTrainPath() { trackRect = CGRect(x: 0.0, y: 0.0 - roomHeight/2 + tracksHeight, width: tracksWidth, height: tracksHeight) // trackRect = (0.0, -207.0, 940.0, 476.0) // portrait // trackRect = (0.0, -274.0, 470.0, 238.0) // landscape print("trackRect = \(trackRect!)") trackPath = UIBezierPath(ovalIn: trackRect) let theTrackShapeNode = SKShapeNode(path: trackPath.cgPath, centered: true) theTrackShapeNode.zPosition = 100 // for testing theTrackShapeNode.position = myTracks.position theTrackShapeNode.lineWidth = 4.0 theTrackShapeNode.strokeColor = SKColor.blue if let ourScene = GameScene(fileNamed: "GameScene") { print("here") // this shows ourScene.addChild(theTrackShapeNode) // does *not* show? } } // createTrainPath In Portrait mode, the UIScreen measures 1024 x 1366 and the Track measures 940 x 476 with its top edge down 207 from the center of the UIScreen. In Landscape mode, the UIScreen measures 1366 x 1024 and the Track measures 470 x 238 with its top edge down 274 from the center of the UIScreen. In both modes, the bottom edge of the Track is supposed to be flush with the bottom edge of the UIScreen .. and it is. If the math is correct, then I am obviously not understanding the math of the layout .. because the UIBezierPath is not showing. The math appears correct .. but the UIBezierPath just is not showing. So where is my brain off-center?
3
0
719
Dec ’23
How to prevent initial rotation of a node when following a UIBezierPath?
Problem = I have a locomotive trying to follow an oval-shaped UIBezierPath. The challenge is that when I use orientToPath:true in my call to SKAction.follow, the locomotive immediately rotates even though the locomotive is initially positioned on the straight portion of the oval before it reaches the rounded portion of the oval. If I could prevent this initial rotation, then the rotation would not happen until it reached the rounded portion of the oval - as it should. So, can you please provide some guidance as to how I could prevent this initial rotation? Here is the code: func createTrainPath() { // this custom method ensures that the locomotive // moves CW, versus CCW trackPath = getBezierPath(theNode: myTrain, offset: 0.0) } // createTrainPath func startFollowTrainPath() { let theSpeed = Double(5*thisSpeed) var trainAction = SKAction.follow( trackPath.cgPath, asOffset: true, orientToPath: true, // <== speed: theSpeed) trainAction = SKAction.repeatForever(trainAction) myTrain.run(trainAction, withKey: runTrainKey) } // startFollowTrainPath
3
0
719
Jan ’24
GameScene’s didBegin is not called?
GameScene’s didBegin is not called? I have read a high volume of solutions here and many, many other Sites and I cannot figure out why? What am I doing wrong? Here are my relevant 2  Code Snippets: Within GameViewController, this function is called every time I show the CGScene: var noCollision: UInt32 = 00000000,     noContact: UInt32 = 00000000 func addGamePiecesToScene(toScene: SKScene) {                // thisSceneName is set before we're called     if thisSceneName == "GameScene" {         /*             BACKGROUND         */         // GameScene.sks file loads this for us, but         // we still need myRoom to set the data below:         myRoom = SKSpriteNode(imageNamed: roomImg)         myRoom.name = "room"         myRoom.zPosition = 0         myRoom.size = CGSize(width: roomWidth, height: roomHeight)         myRoom.physicsBody = SKPhysicsBody(rectangleOf: myRoom.size)         myRoom.physicsBody?.categoryBitMask    = roomCategory         myRoom.physicsBody?.collisionBitMask   = noCollision         myRoom.physicsBody?.contactTestBitMask = noContact              /*             MAIN Game Pieces         */         myPaddle = SKSpriteNode(imageNamed: paddleImg)         myPaddle.name = "paddle"         myPaddle.zPosition = 3         myPaddle.size = CGSize(width: paddleWidth, height: paddleHeight)         myPaddle.position = CGPoint(x: paddlePosX, y: paddlePosY)   // = original or moved         myPaddle.physicsBody = SKPhysicsBody(rectangleOf: myPaddle.size)         myPaddle.physicsBody?.categoryBitMask    = paddleCategory         myPaddle.physicsBody?.collisionBitMask   = roomCategory | ballCategory         myPaddle.physicsBody?.contactTestBitMask = roomCategory | ballCategory         myPaddle.physicsBody!.affectedByGravity = false         myPaddle.physicsBody!.isDynamic = true         toScene.addChild(myPaddle)         //         myBall = SKSpriteNode(imageNamed: ballImg)         myBall.name = "ball"         myBall.zPosition = 4         myBall.size = CGSize(width: ballWidth, height: ballHeight)         myBall.position = CGPoint(x: ballPosX, y: ballPosY)   // = original or moved         myBall.physicsBody = SKPhysicsBody(rectangleOf: myBall.size)         myBall.physicsBody?.categoryBitMask    = ballCategory         myBall.physicsBody?.collisionBitMask   = roomCategory         myBall.physicsBody?.contactTestBitMask = roomCategory         myBall.physicsBody!.affectedByGravity = false         myBall.physicsBody!.isDynamic = true         myBall.physicsBody!.usesPreciseCollisionDetection = true         toScene.addChild(myBall)         /*             EXTRA Game Pieces = bird, rock, trees + tower are loaded by the .sks File         */     }   // if thisSceneName == "GameScene"       }   // addGamePiecesToScene Within my GameScene is the cited didBegin function: func didBegin(_ contact: SKPhysicsContact) {     print("didBegin")   // never shows in Console                              // Respond to an object hitting other objects based on their names                  let bodyAName = contact.bodyA.node?.name     let bodyBName = contact.bodyB.node?.name     // N.B. – according to Apple docs,     //        there is no guarantee which object is bodyA and which is bodyB     let paddleHitWall = ((bodyBName == myPaddle.name) && (bodyAName == myRoom.name))  ||                         ((bodyAName == myPaddle.name) && (bodyBName == myRoom.name))     let ballHitWall   = ((bodyBName == myBall.name)   && (bodyAName == myRoom.name))  ||                         ((bodyAName == myBall.name)   && (bodyBName == myRoom.name))     let paddleHitBall = ((bodyBName == myPaddle.name) && (bodyAName == myBall.name))  ||                         ((bodyAName == myPaddle.name) && (bodyBName == myBall.name))       if paddleHitWall {         ouch()         movePaddle(dx: -dPaddleX, dy: -dPaddleY)         print("paddle hit Wall")    }    else if ballHitWall {         moveBall(dx: -dBallX, dy: -dBallY)         print("ball hit Wall")    }    else if paddleHitBall {         attaBoy()         moveBall(dx: -dBallX, dy: -dBallY)         print("paddle hit ball")    } }   // didBegin What in the above 2 Code Snippets is wrong and, when corrected, didBegin is once again called?
2
0
713
Feb ’23
Where do I place my code to instantiate my Project’s `struct` code within `SwiftUI`?
Where do I place my code to instantiate my Project’s struct code within SwiftUI? As you can see way below, I call: _ = StaticObjects() Within GameScene’s didMove It seems the reason I don’t see the same #Preview image in my GameScene is that I am not explicitly returning a SwiftUI some View within my struct layout. I do know that didMove is really called .. but I just don’t see anything within the Simulator My #Preview works great: The following code appears within GameScene.swift of my Xcode Project: import SpriteKit import SwiftUI struct StaticObjects : View { // some View is returned when our struct is instantiated var body: some View { let theBuildings = ["hotel", "saloon", "watertower", "jail", "farmhouse", "barn"] let theFigures = ["desperado", "sheriff", "space", "space", "horse", "guy"] VStack { HStack(alignment: .bottom) { ForEach(theBuildings, id: \.self) { theBuilding in Image(theBuilding) .resizable() // for rotation .scaledToFit() .zIndex(2) Spacer() } // ForEach } // HStack for theBuildings HStack(alignment: .bottom) { ForEach(theFigures, id: \.self) { theFigure in Image(theFigure) .resizable() // for rotation .frame(width: 120, height: 230) .offset(x: 0.0, y: -50.0) .zIndex(2) Spacer() } // ForEach } // HStack for theFigures // aligns vertically the entire struct to the top Spacer() } // VStack } // body: } // struct StaticObjects /* #Preview { StaticObjects() } */ class GameScene: SKScene, SKPhysicsContactDelegate { override func sceneDidLoad() { super.sceneDidLoad() } // sceneDidLoad override func didMove(to view: SKView) { super.didMove(to:view) physicsWorld.contactDelegate = self _ = StaticObjects() // doesn’t work } // didMove func didBegin(_ contact: SKPhysicsContact) { // ... } // didBegin } // class GameScene
2
0
446
Dec ’23
Calling SKAction.follow(..) causes my SKSpriteNode to rotate 90 degrees CW and not stay horizontal as it follows my UIBezierPath?
Calling SKAction.follow(..) causes my SKSpriteNode to rotate 90 degrees CW and not stay horizontal as it follows my UIBezierPath? I have this code (within my GameViewController Class) which implements the following of a SKSpriteNode along a UIBezierPath. ===== Please note that a brilliant contributor solved the above challenge by creating a new Class, e.g., class NewClass: NSObject. Nevertheless, I need the solution to appear in an extension of my GameViewController ===== func createTrainPath() { trackRect = CGRect(x: tracksPosX - tracksWidth/2, y: tracksPosY, width: tracksWidth, height: tracksHeight) trainPath = UIBezierPath(ovalIn: trackRect) } // createTrainPath func startFollowTrainPath() { var trainAction = SKAction.follow( trainPath.cgPath, asOffset: false, orientToPath: true, speed: theSpeed) trainAction = SKAction.repeatForever(trainAction) myTrain.run(trainAction, withKey: runTrainKey) } // startFollowTrainPath func stopFollowTrainPath() { guard myTrain == nil else { myTrain.removeAction(forKey: runTrainKey) savedTrainPosition = getPositionFor(myTrain, orPath: trainPath) return } } // stopFollowTrainPath
2
0
1.3k
Jul ’24
How to ensure current SKScene has fully loaded before engaging it with the GamePad Controller?
How to ensure current SKScene has fully loaded before engaging it with the GamePad Controller? The problem is this = when stopping sound is involved when I do switch SKScenes, if I press the buttons of the GamePad Controller (which cycle thru these other SKScenes) too fast, the movement of the Game Pieces fails to resume when I return to the Game Scene after the above cycling. This problem occurs only with the os(tvOS) version, but not with the iPad version. And the reason for this distinction is that each SKScene for the iPad has to fully load due to the fact that the button I press to switch SKScenes is at the top-left corner of the iPad -- so, by definition, by the time I have access to this button, the current SKScene has fully loaded. By definition, there is no such button for os(tvOS). Given this button’s absence, I believe I need the Swift version of jQuery’s $(document).ready (function() {. Any help will be appreciated to the rafters ...
2
0
845
Jul ’24
How do I stop a node as it is moving around a UIBezierPath and then restart the moving from where it stopped?
I have an oval UIBezierPath with a moving SKSpriteNode, I stop its motion and record the stopped position. I then restart this motion and want it to restart where it initially stopped. Works great if motion is not stopped. Movement is great around entire oval Path. Also works great as long as this stop-restart sequence occurs along the top half of the oval UIBezierPath. However, I have problems along the bottom half of this Path -- it stops okay, but the restart position is not where it previously stopped. My method to create this oval UIBezierePath is as follows: func createTrainPath() { trainRect = CGRect(x: tracksPosX - tracksWidth/2, y: tracksPosY - tracksHeight/2, width: tracksWidth, height: tracksHeight) // these methods come from @DonMag trainPoints = generatePoints(inRect: trainRect, withNumberOfPoints: nbrPathPoints) trainPath = generatePathFromPoints(trainPoints!, startingAtIDX: savedTrainIndex) } // createTrainPath My method to stop this motion is as follows: func stopFollowTrainPath() { guard (myTrain != nil) else { return } myTrain.isPaused = true savedTrainPosition = myTrain.position // also from @DonMag savedTrainIndex = closestIndexInPath( trainPath, toPoint: savedTrainPosition) ?? 0 } // stopFollowTrainPath Finally, I call this to re-start this motion: func startFollowTrainPath() { var trainAction = SKAction.follow(trainPath.cgPath, asOffset: false, orientToPath: true, speed: thisSpeed) trainAction = SKAction.repeatForever(trainAction) myTrain.run(trainAction, withKey: runTrainKey) myTrain.isPaused = false } // startFollowTrainPath Again, great if motion is not stopped. Movement is great around entire oval Path. Again, no problem for stopping and then restarting along top half of oval .. the ohoh occurs along bottom half. Is there something I need to do within GameScene's update method that I am missing? For example, do I need to reconstruct my UIBezierPath? every time my node moves between the top half and the bottom half and therein account for the fact that the node is traveling in the opposite direction from the top half?
2
0
863
Nov ’24
External soundbar not playing nice with TV
Apple TV Samsung TV SONOS Soundbar + S1 stereo speakers Apple TV Preferences Sound output = SONOS soundbar Samsung Preferences Sound Output = SONOS HDMI eArc soundbar start with Apple TV movies and as I switch from movie to movie, sound comes out stereo as it should however when I switch to Netflix or YouTube TV with stereo content, sound comes out mono .. until I manually change the ATV Preferences to stereo. As ong as I stay with Netflix content, stereo output. But change to YouRube TV or ATV, it automatically changes to mono. ?????
2
0
188
Feb ’25
PlaySound below crashes with this error: AddInstanceForFactory: No factory registered for id
Problem = PlaySound below crashes with this error: AddInstanceForFactory: No factory registered for id Setting a breakpoint before the guard let url block = NO error. Setting a breakpoint after the guard let url block = error!!, coupled with a horrible static sound happening. Note that if I set NO breakpoints, the correct sound happens but with the above error. What am I missing? Within my SKScene Class: func controllerInputDetected(gamepad: GCExtendedGamepad, element: GCControllerElement, index: Int) { // rightShoulder if (gamepad.rightShoulder == element) { if (gamepad.rightShoulder.value != 0) { startGame() } } } As shown above, I call the following function by pressing a shoulder button on my Gamepad: func startGame() { PlaySound(theSoundName: "roar") } func PlaySound(theSoundName: String) { guard let url = Bundle.main.url(forResource: "audio/" + theSoundName, withExtension: "mp3") else { print("sound not found") return } do { try AVAudioSession.sharedInstance().setCategory(.playback, mode: .default) try AVAudioSession.sharedInstance().setActive(true) itsSoundPlayer = try AVAudioPlayer(contentsOf: url) if theSoundName == "roar" { itsSoundPlayer?.numberOfLoops = -1 // forever } itsSoundPlayer!.play() } catch let error as NSError { print("error: \(error.localizedDescription)") } } Again, what am I missing?
1
0
967
Jan ’23
Unfathomable Conduct - App Review Process
App Review Process (1) first attempt: rejected for a reason not supported by App Connect. For example, “You did not state that your App requires a Game Controller”. 100% refuted by App Connect’s description and promotional texts for all Apps in the App Store. (2) second attempt = I get accused of a personal attack. Crocodile tears when in fact I am simply building a stream of logic that refutes their non-factual assertions. This futile attempt to dissuade others is very often used when they can no longer refute the logical responses. This attempt is quite often used by politicians. (3) their last resort is to simply ignore my submission and forever keep my status = In review. Life in prison without parole. (4) good question = do I put my legal team into gallop mode? Why? Because I and many others have reported very similar issues. Someone needs to say “No more!” (5) These issues all reduce to one = a deity complex that many Reviewers have. Synonymously they are saying “We have power and we will crush you”. For this reason their rejection reasons become a moving target. Most of the time this ploy works, but not now. (6) I am a retired United States Air Force officer and we all saw this deity complex in full display in the late 1930’s … Auschwitz occurred and World War II resulted. I saw it up close and personal in Vietnam. I personally saw Quonset huts full of dismembered U.S. heroes. And we see it full grown now here and overseas .. leaving the probability of World War III = high. The clique of long ago App Developers will most likely result in slanderous statements against me. But sometimes an adult must stand and say “ No more!”
1
0
1.3k
Feb ’23
How can I make my Game App appear under Games in the App Store and not under Apps?
The reason I ask centers on the fact that my "Monster Paddle Pong" has been uploaded to the App Store - and it works! BTW: Search within Apps - not Games! Within Xcode I selected App Category = Games and the above search agrees with that. My question = how can I in the future make my Game appear under Games in the App Store and not under Apps?
1
0
652
Feb ’23
Trouble making SKSpriteNode bounce off anotherSKSpriteNode using Bit Masks and func didBegin(..)
Trouble making SKSpriteNode bounce off anotherSKSpriteNode using Bit Masks and func didBegin(..) Here are some brief Code Snippets: For brevity, let's consider 4 SKSpriteNode's The Bit Masks and the .png Strings are defined within AppDelegate, along with: var noCollision: UInt32 = 00000000 var noContact: UInt32 = 00000000 var roomCategory: UInt32 = 00000001 var playerCategory: UInt32 = 00000010 var ballCategory: UInt32 = 00000100 var UCategory: UInt32 = 00001000 Next Snippet appears within GameViewController which calls .addChild for each Node: myRoom = SKSpriteNode(imageNamed: "room.png") myRoom.size = CGSize(width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height) myRoom.physicsBody = SKPhysicsBody(rectangleOf: myRoom.size) myRoom.physicsBody?.categoryBitMask = roomCategory myRoom.physicsBody?.contactTestBitMask = noContact myPlayer = SKSpriteNode(imageNamed: "player.png") myPlayer.size = CGSize(width: playerWidth, height: playerHeight) myPlayer.physicsBody = SKPhysicsBody(rectangleOf: myPlayer.size) myPlayer.physicsBody?.categoryBitMask  = playerCategory myPlayer.physicsBody?.collisionBitMask = noCollision myPlayer.physicsBody?.contactTestBitMask = noContact myBall = SKSpriteNode(imageNamed: "ball.png") myBall.size = CGSize(width: ballWidth, height: ballHeight) myBall.physicsBody = SKPhysicsBody(rectangleOf: myBall.size) myBall.physicsBody?.categoryBitMask = ballCategory myBall.physicsBody?.collisionBitMask = noCollision myBall.physicsBody?.contactTestBitMask = roomCategory | UCategory myUStake = SKSpriteNode(imageNamed: "ustake.png") myUStake.size = CGSize(width: U1Width, height: U1Height) myUStake.physicsBody = SKPhysicsBody(rectangleOf: myU1.size) myUStake.physicsBody?.categoryBitMask = UCategory myUStake.physicsBody?.collisionBitMask = noCollision myUStake.physicsBody?.contactTestBitMask = ballCategory Finally, here's my func didBegin func didBegin(_ contact: SKPhysicsContact) {                                                   let bodyAName = contact.bodyA.node?.name      let bodyBName = contact.bodyB.node?.name               let playerHitBall = ((bodyBName == myPlayer.name) && (bodyAName == myBall.name))  ||                          ((bodyAName == myPlayer.name) && (bodyBName == myBall.name))               let ballHitU      = ((bodyBName == myBall.name)   && (bodyAName == myU1.name))    ||                          ((bodyAName == myBall.name)   && (bodyBName == myU1.name))               if playerHitBall {      //     moveBallIfHitsWall()      //     attaBoy()           print("player hit ball")       }       if ballHitU {       //    attaBoy()       //    moveBallIfHitsUStake(theUStake: UStakes[0])           print("ball hit U1")       } }   // didBegin No print statements show in the Debugger. Anybody that has some light to shine on my error or errors would be greatly appreciated. Thanks in advance.
1
0
512
Mar ’23
With Xcode 14.2, I unpaired my apple tv and now the apple tv does not show
With Xcode 14.2, had trouble pairing with my Apple TV (latest update). It continuously showed "Not Connected". So, I unpaired my apple tv and now the ATV does not show under Devices and Simulators. My ATV shows as the Target of my Xcode Project My Ventura 13.3 iMac mirrors to my ATV just great, but not my Xcode 14.2. Have turned off my ATV, quit Xcode and Shutdown and then re-started my iMac and no luck. Help desperately needed. Other posts seem to show an identical problem experienced by others.
1
0
939
Apr ’23
game controlllers and Mac OS 13.3
Specifically the Nimbus+ ... but I tried for a few days a PlayStation Dual Sense ... and the identical problem with just Mac OS Ventura 13.3. One more thing, ZERO problems with my iPhone and your Apple TV. So, the following problem is ONLY with Ventura 13.3 (NOT 13.2 and earlier - just 13.3). Here's the problem .. the Nimbus+ will not stay connected and after about 15 seconds disconnects by itself. The above PlayStation Dual Sense sticks around for about 60 seconds and then disconnects by itself. For the record, I have several times chatted with Nimbus Tech Support. Total Failure, sorry to say. Some chatter out there in Google Land said that the blinking lights on my Nimbus+ show (to him) that the chargeable batteries are "bricked" and need to be reset. If true, then why does my Nimbus+ work great with my iPhone and Apple TV? Just asking ... I'm a computer programmer but I am not a hardware person who can take apart the Nimbus and hit its reset button. There you have it ... any help at all will be appreciated. JL
1
0
1.7k
Apr ’23