Post

Replies

Boosts

Views

Activity

Cannot add a iOS Distribution Certificate to my Project or Target?
Cannot add a iOS Distribution Certificate to my Project or Target? During the Submission for Review process, it states I should choose a Build (for Distribution) and I need to do the above add before I can do that. Here is a screen shot of my Certificates set in my Developer Account: Here is the screen shot when I double-click on the iOS Distribution Certificate above: Here is a screen shot of that Certificate in the Finder: Yet in spite of all the above evidence, here is a screen shot of my Target for both my iOS and tvOS Project: So, please provide some hints because this is the only step left before I finally submit my App to the App store.
3
0
2.4k
Feb ’23
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
Moving a SKSpriteNode image in response to a change in its position
Moving a SKSpriteNode image in response to a change in its position is not working. Based on the code below, does anyone have an idea why? N.B. I change the position of the image within my class GameScene. Then, I call, e.g., this function: func drawBall() {             let positionInSceneCoordinates = CGPoint(x: ballPosX, y: ballPosY)             myBall!.removeAction(forKey: "moveTO")     let moveTO = SKAction.move(to: positionInSceneCoordinates, duration: TimeInterval(1))     myBall!.run(moveTO, withKey: "moveTO)") } Selective placement of print statements prove that the ballPosX, ballPosY are changing as they should, but I am observing zero movement on the Xcode Simulator via the call to myBall!run(..). I am at a loss here on how to proceed. Thanks bunches!
4
0
634
Feb ’23
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