Posts

Post marked as solved
2 Replies
4.6k Views
I have the following warning in my application and have no idea how to resolve it. Any ideas? Large Style before iOS 13.0Googling around did not provide much insight, however, it seems to be related to the Activity Indicator object I am using on my ViewController, which has it's property set to "Large". Note: If I seet the property to "Medium" then I get a warning called "Medium Style before iOS 13.0" instead
Posted
by uncletr.
Last updated
.
Post marked as solved
6 Replies
7.1k Views
I am new to swift and have been working my first application for a while now. During testing I have seen some crashes in my code and I believe they are caused by some of the UI updates not being processed on the main thread. I googled around and I read all "UI Updates" need to be made on the main thread. Will someone please confirm what exactly a "UI update" actually is for me?Do I need to wrap all of the following inside "DispatchQueue.main.async" ?updating text in a TextViewupdating a UIButton textadding corner radius and button width values to a UIButtoneverytime I want to present an alert messageeach time I call "dismiss(animated: true, completion: nil)" to close the current ViewController and return to the previous oneeach time I call "storyBoard.instantiateViewController(withIdentifier: )" to create a ViewController and also when calling "present( )"updating the myLabel.frame.size values (width and height)updating a scrollview.frame.size valuewhen the "isHidden" property of a button, label, etc is setsetting colors to labels, buttons, etc.In my viewDidLoad( ), viewWillLayoutSubviews( ), viewDidLayoutSubviews( ), etc. functions I hide objects, set borders, set colors, set ScrollView sizes, etc.. so would I use "DispatchQueue.main.async" inside all of these functions?I do a bunch of UI updates (I believe) so wanted to understand whether I need to add a ton of separate "DispatchQueue.main.async" wrappers all over my code. It seems I would need plenty and I am concerned about polluting my code, where all you see is a ton of "DispatchQueue.main.async" wrappers all over the place.Does my application start off using the main thread and then for some reason goes into the background thread? if so, then perhaps I would only need to use Dispatch in cases where my application would switch to the background thread? I would not know when this would occur of course.I am also concerned that if I use "async" throughout my code then the code inside the Dispatch region will not execute right then but rather continue on executing the code located after/outside the dispatch region, whcih would be out of order as I would like the code to execute.Perhaps someone can confirm all of this for me?ASIDEI tried using a DispatchQueue.main.async code wrapper around some code which updates label and button text. I confirmed the code inside the Dispatch region occasionally does not execute. I see the print statements which are before and after the Dispatch region but sometimes(occasionally) the print statements inside the region do not get hit. Should I be using "sync" instead of "async" to guarantee by code always runs when I want it to?
Posted
by uncletr.
Last updated
.
Post marked as solved
5 Replies
993 Views
Help Please ... My application development has completely stopped.I mistakenly clicked "DENY" button when prompted to enter my password for loading my application on to my iPhone and now I can no longer load my application on "any" iPhones I have available for testing. Clicking the RUN button in XCode, "immediately" results in Build Failed and then clicking on the little RED error circle indicates the following: "Command CodeSign failed with a nonzero exit code"Typically, I would do the following to successfully load my application on my iPhone for testing:Attach my iPhone via USB cable to my MacBook AirSelect my iPhone from the dropdown box (instead of a simulator)Click RUNEnter my Macbook Air password to allow the application to be loaded on to my iPhoneApplication starts on my iPhone and can be used with XCode for debuggingI googled around for this error and see it has something to do with Mac KeyChain and certificates. I am "not" a Mac user at all so going in and messing with certificates makes me very nervous. I am afraid I will really mess something up and then not be able to develop my application anymore.Since I clicked DENY, I am assuming this is blocking all iPhones from being loaded. How do I ALLOW again so XCode will start prompting me to enter my password again and allow my iPhones to be loaded and used for testing once againCompiling and running using a specific Xcode simulator is still working, however, I need real iPhone to continue testing my app at this pointI tried "Product/Clean Build Folder" but this still did not allow me to load my real iPhone. In "KeyChain Access" I do/see the following:Select Login (Key Chains)Select Keys (Category)I see "Apple Development - <my Name> (private key)" listedClicking the little "expand arrow" icon I can see the following associated certificate: Apple Development - <my Name> (Cert ##) (certificate)After right-clicking the "(private key)" entry, selecting "Get Info" then "Access Control", I see the following option set: Allow all appplications to access this itemAfter right-clicking the "(certificate)" entry, selecting "Get Info" and expanding the "Trust" section, I see the following option set: When using this certificate = Use System Defaults
Posted
by uncletr.
Last updated
.
Post marked as solved
8 Replies
722 Views
PLEASE HELP. I found a big problem :>(I just discovered a real big problem with my game logic involving how players are joined together into a match and I am hoping someone can help me resolve itRequirements for my applicationA player can either HOST a match or FIND a match to join. (Note: The HOST player sets all of the game options such as number of players, number of rounds, number of cards, etc..)Every match created must have only "one" HOST player onlyAll players who request to FIND a match (ie: non-host players) must ONLY join a match which is being hosted and not have a match created between themselves, which does not include a host.Example:Player1 is hosting a 2-player match and is actively searching for one more player to join the match. At this time, two separate players (non-host players) each make separate requests to FIND a random match to join. Sometimes, I see a match is created between the two non-host players, while the HOST player keeps spinning looking for a player to join.Question:How can I ensure all non-host players only join a match which is being hosted, instead of creating a match between themselves?My existing application match logic:1) When a player requests to HOST a match (eg: 2-player match) then the following match request is made, which will result in the GKMatchmakerViewController window being displayed so players can be located to fill the match slots: let request = GKMatchRequest.init( ) request.minPlayers = 2 request.maxPlayers = 2 request.playerAttributes = 0xFFFF0000 <-- represents HOST player (see note below) let mmvc = GKMatchmakerViewController.init(matchRequest: request)Note: The 0xFFFF0000 playerAttribute value ensures multiple HOST players, who are actively searching for players for their match, are not joined together into the same match. Basically, if the match already has a player with attribute 0xFFFF0000, then another player with attirbute 0xFFFF0000 cannot also join the same match.2) When a player requests to FIND a match (eg: 2-player match) to join then following the match request is made to programmatically find a match: let matchRequest = GKMatchRequest.init( ) matchRequest.minPlayers = 2 matchRequest.maxPlayers = 2 matchRequest.playerAttributes = 0 <---indicates player is NOT A HOST and can join any match available GKMatchmaker.shared().findMatch(for: matchRequest, withCompletionHandler: ...)In my 2-player non-host "Problem" described above, I understand why the two non-host players create a match between themselves. They are both requesting to find a 2-player match while both have player attributes set to "0". Is there a way to make non-host players only join a game with a HOST player?
Posted
by uncletr.
Last updated
.
Post marked as solved
2 Replies
451 Views
In my application, the player can HOST a game or can JOIN(FIND) a game randomly.The HOST player calls the function below to create a match with min/max players. This results in the "GKMatchmakerViewController" being displayed where the HOST can then select "Play Now" to find other players automatically. When all players are found and the match is created, then the "didFind match" function (below) is called. findMatchWithGKMatchmakerVC(minPlayers: Int, maxPlayers: Int) matchmakerViewController(_ viewController: GKMatchmakerViewController, didFind match: GKMatch)The player who wants to JOIN(FIND) a match calls the following function to find a match to join. When the match is located and the match instance is provided, then the completion handler of this function is called. GKMatchmaker.shared().findMatch(for: matchRequest, withCompletionHandler: )After a player requests to JOIN a match, my application allows the player the option of "canceling" the match in case they want to stop waiting. If the player cancels their request, then I need to ensure the current game environment is "cleaned up" properly so if the player then decides to make another JOIN request then their request will work. I have seen when a player requests to JOIN, then cancels, then re-requests to JOIN, then the active GKMatchmakerViewController will not find the player at all. This makes me think that I did not "clean up" my previous JOIN request properly/fully.I am performing the following to "clean up" the game environment when a player cancels their JOIN match request.1) When the call to find a match has been made but the "matchrequest completionHandler" has not been called yet (ie: no "match" instance provided by Game Center yet), then I call the following to cancel the match request only: GKMatchmaker.shared().cancel( )2) Otherwise, when the "matchrequest completionHandler" was called already (meaning a "match" instance was provided by Game Center), then my application calls the following to disconnect from the match only myMatch.disconnect( )QuestionDo I need to do anything else to properly clean up the Game Center match request in my game environment?
Posted
by uncletr.
Last updated
.
Post marked as solved
3 Replies
461 Views
Clicking the "Play Now" button on the GameCenter Matchmaker ViewController results in an extremely fast "Error Failed to find players" window popping up. Also clicking the "Invite Friends" button does not display any of the friends, but rather the GameCenter ViewController does nothing.It would be great if someone else could confirm whether they are having the issue or whether this is somehow some unknown issue with my application all of a sudden.
Posted
by uncletr.
Last updated
.
Post marked as solved
1 Replies
1.2k Views
My card game application has a TextView inside of a ScrollView and uses the TextView to display the scores for each player in the game for each round played The TextView is populated with with multiple lines of text string data (see example below). Round Player1 Player2 Player3 Player4 Player5 Player6 9 3/2 10 1/2 20 0/3 10 3/1 13 4/0 10 3/3 13 8 4/1 14 2/3 23 1/3 10 4/3 13 2/2 22 1/1 21 7 1/1 24 2/2 33 3/2 13 4/2 14 1/2 25 2/2 32 6 etc.. 5 etc.. 4 etc.. 3 etc.. 2 etc.. 2 etc.. 3 etc.. 4 etc.. 5 etc.. 6 etc.. 7 etc.. 8 etc.. 9 etc..After appending a new text line into the TextView, I resize the TextView (width and height values) so each line can be seen on its own line to avoid any word wrapping from taking place. The ScrollView.contentsize is then set to the TextView.frame.size. This allows the text in the TextView to be scrolled left/right and up/down for viewing.ISSUEWhen the TextView is populated with 40-50 lines of text (each having about 100 characters), then the text display will start to flicker on/off quickly when scrolling is occurring. If I keep scrolling up/down or left/right while flickering is currently occurring, then the flickering will get worse and the full TextView display starts to disappear/reappear/disappear/reappear (worse than just flickering) until eventually the app crashes.During my testing, when the TextView only has 12 lines of text (each having about 100 characters), I can constantly scroll left/right/left/right/etc. without any flicker for a while, however, eventually (after scrolling left/right/left/right for about 20 times back and forth) then flickering starts to occur. Once the flickering occurs then the flickering is constant until I stop scrolling left/right. If I stop scrolling for 10-15 seconds then start the left/right/left/right scrolling again then the scrolling works fine until I scrolled back and forth about 20 times again, then flickering starts up again. I cannot get it to crash with only 12 lines of text in the TextView. To get it to crash I need about 40-50 lines of data in the TextViewWhen flickering occurs, I see MANY MANY of the following lines displayed in the simulator debug window: CoreAnimation: failed to allocate ###### bytesIn the case where a crash eventually occurs, I see the following in the debug window as well: malloc: can't allocate region securelyWhy would a TextView inside of a ScrollView start to flicker when populated with only 12 lines of text (100 characters per line)? This does not seem like a lot of data. Any ideas what is going on and how I can potentially fix this issue?This issue is seen on my real iPhone and logs were obtained when it was connected to the Xcode simulator. If I simply run my application in the simulator only (not using a real iPhone) then I do not see the flickering occur.
Posted
by uncletr.
Last updated
.
Post marked as solved
2 Replies
1.5k Views
My game uses Game Center and is required to send and receive "data" between all players in the game.I convert my game data text string (ie: textStr) into byte data using the code below. I then send the byte data out. var byteData = Data.init() byteData = textStr.data(using: .ascii)!When the byte data is received, I convert the byte data back into a game data text string (ie: receivedStr) using the code below: let receivedStr = String(data: didReceiveData, encoding: .ascii)!The game data text string I am sending includes the player's Game Center "displayName" value. It just occurred to me that the Game Center "displayName" value might not be completely made of ascii characters. If this is true, then the code used to convert my game data text string into byte data (see above) will crash since a non-ascii character will be encountered.Question:How can I convert a text string, which might include non-ascii characters, into byte data so it can be sent/received successfully?
Posted
by uncletr.
Last updated
.
Post marked as solved
4 Replies
14k Views
I am a first time developer who created a card game which I now want to submit into the AppStore. Apple Connect indicates I need to add a mandatory Privacy Policy URL. I am not familiar with URL stuff so really have no idea what this involves. Perhaps someone can describe what is needed at a high level just so I can understand better?1) How does one go about getting a URL? Does this mean I have to pay for my own website?2) How does one associated a privacy policy on a URL?
Posted
by uncletr.
Last updated
.
Post marked as solved
7 Replies
1.4k Views
I have an iPhone 8 and can use it to start a two player match using the Xcode simulator and my Iphone 8 to test my application. This works fine. I now want to test other iPhone models in two player mode. IssuesI select a different iPhone model in the simulator, start my application in the simulator and then host a 2-player match. I use my iPhone8 to join a 2 player match but Game Center never starts the match. I noticed I can only establish a 2-player match successfully if the simulator is set to "iPhone 8", which is the same model of my physical iPhone I have available for testing1) Does the simulator only allow testing with the exact same iPhone models only for some reason? Or perhaps there is a setting somewhere which will allow different models in the simultor to be used?2) I also downloaded the 12.4 simulator for the iPhone8 into Xcode so I could test that my applicaiton works on iOS 12.4, however, I cannot establish a 2-player game using my iPhone8 which is at 13.3 iOS version. Does Game Center allow players of different iOS versions to play together?
Posted
by uncletr.
Last updated
.
Post marked as solved
11 Replies
1.3k Views
I am using two real iPhones (A and B) to test game center "Invite" logic and I am getting confused.I use iPhone-A to start my game and then launch the GKMatchmakerViewController. I then select the "Invite Friends" button and select a friend to invite (which is iPhone-B).On iPhone-B, I receive a popup message asking whether I want to join the game. After I click the popup message, I see my game is launched on iPhone-B. At this point, I assume the player( player: didAccept invite:) function would be called on iPhone-B automatically and then a GKMatchmakerViewController should be created by providing the GKInvite object by calling the function below: let mmvc = GKMatchmakerViewController(invite: inviteToAccept) mmvc!.matchmakerDelegate = self viewController.present(mmvc!, animated: true, completion: nil)Where does the "viewController" comes from to allow me to present/display the GKMatchmakerViewController?Can someone explain how they present the GKMatchmakerViewController when the didAccept function is called?
Posted
by uncletr.
Last updated
.
Post marked as solved
4 Replies
528 Views
I understand the simulator cannot be used to send an game Invite to an iPhone. As a result, I have two real iPhones which I am using. How can I see the logging generated from the iPhone that receives the Invite? This iPhone does not currently have the application running when the Invite comes in, so is there a way to have an iPhone connected to the Xcode debugger before the application is even woken up due to receiving an Invite?
Posted
by uncletr.
Last updated
.
Post not yet marked as solved
0 Replies
373 Views
My son has an iPhone 6 which is stuck at iOS 12.4.4 since it is no longer supported I guess. My iPhone is at iOS 13.3.1. When I go into my Settings/Game Center and try to add him as a friend, he receives a IM message asking if he will be my friend. When he clicks on it, a display pops up indicating he must upgrade to iOS 13.3 to accept the friend invite.1) Is there anyway around this so I can add my son as a "Friend" in Game Center?2) Most importantly, will I be able to "Invite" my son into a match using the GameCenterMatchMaker view controller when my game is completed? If it matters, the "Deployment Info" for my game in XCode indicates a "Target = iOS 12.4" . I assume this means my game will be allowed to be downloaded by any iPhone having iOS 12.4 or greater ?
Posted
by uncletr.
Last updated
.
Post marked as solved
1 Replies
446 Views
Is it possible for Game Center to send the exact same data to the same player twice?I am frequently (not all of the time) noticing, the same exact data being received twice, which is causing issues in my application.I am using the following functions in GameKitHelper to send and receive data in my application:func sendDataToPlayer(data: Data!, gkPlayer: GKPlayer) { var playerArray: [GKPlayer] = [ ] playerArray.append(gkPlayer) do { try myMatch?.send(data, to: playerArray, dataMode: .reliable) } catch { } } func match(_ match: GKMatch, didReceive data: Data, forRecipient recipient: GKPlayer, fromRemotePlayer player: GKPlayer)I am experiencing the same exact data coming into the "didReceive data:" function with the exact same data, recipient and player valuesHas anyone seen this duplicate data issue before?I see this issue when testing with 2 real iPhones and the simulator (ie: 3 players). I do not see this issue when testing with 1 iPhone and the simualtor (ie: 2 players).As a side question .... what is the difference between:1) match(_: didReceive: forRecipient: fromRemotePlayer:) and2) match (_: didReceive: fromRemotePlayer:)
Posted
by uncletr.
Last updated
.
Post marked as solved
4 Replies
522 Views
Based on the game options within my game, which are selected by the player, there can be multiple types of matches the player could join which have the required "number of players" but also share the same "player group number". I am calling "findMatch()" for each different match type one by one, however, I would like to know what a reasonable time would be to wait for Game Center to determine if there is an actual match in which the player can join. When there is not a match available for the game type I am currently searching for, then I cancel the match request and move on to search for the next type of match, via a new findMatch() call and so on.Would waiting 10 seconds for Game Center to determine if a match exists be reasonable before starting a new "findMatch( )" request in Game Center?
Posted
by uncletr.
Last updated
.