Posts

Post marked as solved
11 Replies
0 Views
I have faced exactly the same problem. Interestingly enough, voice chat works well on my iPhone and iPad Pro running iOS 14, but not on my old iPad running iOS 12.4.9. I get exactly the same errors as in the previous posts. Access to mic is enabled in Settings, voice chat is initiated but no sound. I have another issue with GameCenter voice chat on my son's iPad. But there, initiating voice chat with name after finding a game results in a nil GKVoiceChat object and I do not even see permission to access mic for my application. I wonder if this could be caused by some parental restrictions. Please advise if you have solved the problem. Thanks!
Post marked as solved
8 Replies
0 Views
Which code? Method authenicatePlayer()? For this, you need to have a separate class that will handle all you GameKit methods. Google "raywenderlich gamecenter tutorials" (a tutorial on building a turn-based game has code in Swift). Or where to call GameCenterHelper.sharedInstance.authenticatePlayer?
Post not yet marked as solved
4 Replies
0 Views
I tend to receive this error when a player accepts an invitation, this acceptance is passed to the inviting player, however the player who accepted it fails matchmaking with an error. As a result, the inviting player starts a match without the invited player. I followed up with the Apple's technical support and with their help, rewrote the following method: func player(_ player: GKPlayer, didAccept invite: GKInvite)	{ 				// Accepting invitation from an already open GKMatchmakerViewController         if matchmakerViewController != nil {             matchmakerViewController!.dismiss(animated: false, completion: nil)             self.matchmakerViewController!.matchmakerDelegate = nil             self.matchmakerViewController = nil         } 				// Giving the system time to do a full "clean-up" of matchmakerViewController before starting new task         let delayTime = DispatchTime.now() + .milliseconds(2000) 				// Initiating matchmaking VC on the main thread after the delay         DispatchQueue.main.asyncAfter(deadline: delayTime) {             self.matchmakerViewController = GKMatchmakerViewController(invite: invite)             self.matchmakerViewController!.matchmakerDelegate = self             self.delegate?.presentMatchmaking(viewController: self.matchmakerViewController!)         } } I am testing it now and will report if successful. If this helps solve your issues, please let me know. Cheers.
Post marked as solved
8 Replies
0 Views
No worries. Please feel free to upvote my response if it works. Cheers.
Post marked as solved
8 Replies
0 Views
That should work with any kind of app. It is only a matter where you call authenticatePlayer() and assign the delegate: in didMove(view:) or viewDidLoad() or whatever SwiftUI initial method is (I am old school).
Post marked as solved
8 Replies
0 Views
You can authenticate by using a method along the following lines (in the GameCenterHelp that will be a singleton): func authenticatePlayer() {         GKLocalPlayer.local.authenticateHandler = { gcAuthVC, error in             &#9;&#9;&#9;&#9;// In your delegate, implement method `didChangeAuthStatus`, for example to enable a Game Center button &#9;&#9;&#9;&#9;self.delegate?.didChangeAuthStatus(isAuthenticated: GKLocalPlayer.local.isAuthenticated) &#9;&#9;&#9;&#9;// This is called if the local player gets authenticated. Nothing happens, GKLocalPlayer gets registered &#9;&#9;&#9;&#9;if GKLocalPlayer.local.isAuthenticated {                 GKLocalPlayer.local.register(self)         }          // This is called, when a player opens your app and he|she is not authenticated. &#9;&#9;&#9;&#9; // It opens a viewController with sign-in info &#9;&#9;&#9;&#9;else if let vc = gcAuthVC {                 self.delegate?.presentGameCenterAuth(viewController: vc)         } &#9;&#9;&#9;&#9;// Handing an error while authenticating &#9;&#9;&#9;&#9;else {                 print(">>>>> Error authenticating the Player! \(error?.localizedDescription ?? "none") <<<<<") &#9;&#9;&#9;&#9;} } So, in your GameScene class you may have something like: override func didMove(to view: SKView) { &#9;&#9; GameCenterHelper.sharedInstance.delegate = self      GameCenterManager.sharedInstance.authenticatePlayer()  } @objc func didChangeAuthStatus(isAuthenticated: Bool) {        ... For example, stop spinning activity indicator      &#9;if indicator != nil {             indicator!.stop()             indicator!.removeFromSuperview()             indicator = nil         }         ... Or enable the *PLAY ON GAMECENTER* button         if GKLocalPlayer.local.isAuthenticated {             btnPlayGameCenter.setButtonLabel(title: btnPlayGameCenterTitle(), font: "Noteworthy-Bold", fontSize: 40) } &#9;&#9; &#9;&#9;/** Present the view controller with the Sign-in info */ &#9;&#9;func presentGameCenterAuth(viewController: UIViewController?) {         guard let vc = viewController else {return}         self.view!.window?.rootViewController?.present(vc, animated: true)  }
Post not yet marked as solved
4 Replies
0 Views
Hi. I ran into the same problem. Did you happen to find the solution? Thanks!
Post not yet marked as solved
2 Replies
0 Views
Please disregard. I cannot find an option to delete the post.
Post not yet marked as solved
2 Replies
0 Views
The problem has not been solved in Xcode 12.1.
Post marked as solved
1 Replies
0 Views
Finally, I have figured it out. In Settings -> iTunes&App Stores, the Sandbox Account included my normal email address. This also had to be changed to the Sandbox account.
Post marked as solved
4 Replies
0 Views
What do you mean by "iterated"? If I understand your subject correctly... This can be used when node 1 is just partially within the boundary of the second node:if node1.intersects(node2) { }If you want to know, whether your first node is entirely within the boundaries of the second node, this should work:// Node 1 intersects HEIGHT of Node2 if ( node1BottomY &lt;= node2TopY &amp;&amp; node1TopY &gt;= node2BottomY ) || ( node1TopY &gt;= node2BottomY &amp;&amp; node1BottomY &lt;= node2TopY ) { intersectsHeight = true } // Node 1 intersects WIDTH of Node 2 if ( node1LeftX &lt;=node2RightX &amp;&amp; node1RightX &gt;= node2LeftX ) || ( node1RightX &gt;= node2LeftX &amp;&amp; node1LeftX &lt;= node2RightX ) { intersectsWidth = true } // If Node1 intersects both height and width of Node 2, it is completely withoin its boundaries: if intersectsHeight == true &amp;&amp; intersectsWidth == true { }This is how you may check if half of the first node intesects the second node:if node2.contains(CGPoint(x: node1.frame.midX, y: node1.frame.midY))
Post marked as solved
12 Replies
0 Views
Thanks, bg2b. Interesting approach. Is there more information on how to use a custom shader to blur the background that you could recommend?Cheers.
Post not yet marked as solved
3 Replies
0 Views
iniitamo.Thank you for the response.Is it possible to use SKLabelNode to enter text a-la UITextField?I have read a lot of negative stuff about SKShapeNodes. Thought, many issues had already been solved. I am trying to use rectangulars with rounded corners. How would I do that with SKSpriteNode? Just create a rounded png image and use it as a node texture? The main problem with this approach occurs when my node size changes, e.g. when the height is much smaller than width, the texture image gets disproprtionally squeezed/stretched. Something I do not have with SKShapeNode.Cheers!
Post marked as solved
12 Replies
0 Views
At the end, I abandoned this approach. Takes so much memory to the extent that my daughter's old iPad would crash with an out of memory warning...