I am trying to understand the life cycle of repeatable Game Center achievements (those that have replayable set in GKAchievableDescription) based on what (little) information there is in Apple's Game Center Programming Guide.
Consider e.g. a repeatable achievement "FullCircle". My assumption is that a valid sequence could consist of the following steps:
app calls loadAchievementsWithCompletionHandler:, receives GKAchievement with [achievement.identifier isEqual:#"FullCircle] && (achievement.percentComplete == 0)
user finishes half circle for the first time
app sets achievement.percentComplete = 50 and calls reportAchievements:withCompletionHandler:
iOS Game Center app shows achievement as incomplete (sic!)
user finished full circle for the first time
app sets achievement.percentComplete = 100 and calls reportAchievements:withCompletionHandler:
iOS displays notification banner
iOS Game Center app shows achievement as complete
user finishes half circle for the second time
app sets achievement.percentComplete = 50 (sic!, not: 150) and calls reportAchievements:withCompletionHandler:
iOS Game Center app shows achievement as complete (sic!, because this is the second time)
user finished full circle for the second time
app sets achievement.percentComplete = 100 (sic!, not: 200) and calls reportAchievements:withCompletionHandler:
iOS displays notification banner
iOS Game Center app shows achievement as complete
loadAchievementsWithCompletionHandler: still reports only one (sic!, not: two) achievements for "FullCircle"
Does this make sense or am I making any wrong assumptions in this sequence? And is there any way for inquiring from Game Center how often an achievement such as "FullCircle" was earned?
Related
I am debugging code for achievements in my sprite kit game. When you gain an achievement it goes immediately to 100% achieved - they are one off achievements where you have done a specific thing. The game has NOT been released on the app store.
While doing so I have (somehow) accidentally reported to Game Centre that all my achievements have been completed. To continue debugging I need to reset the achievements to the un-achieved status.
Is there a way to do this?
I know there is resetAchievements(completionHandler: ((Error?) -> Void)? but that just resets percentages of partially completed achievements.
I have 10 achievements at the moment so if there’s no possibility to reset completed achievements then I’ll need to make 10 more, which is tedious, and test them using increments in percentages instead
I use sprite kit, and before I use GameCenter, everything goes fine, but after I add GameCenter, some problems come. After the game scene shows first time, when two sprite contact first time (note that here I will add score), the game scene will stop for around two seconds, and the fps is around zero, but before it is around 60, this is so strange, right? After this contact, everything goes smoothly then, this only happen when first time after launch the game, and I did some changes. Firstly, I comment out the code about adding score when the two sprite contact, and strange, the scene will not stop now, earthing goes fine, but I have to add the score, because the user already win a score. So then I did some advance contact before the game start, which means that the original
score is -1, and I did the advance contact, so when the game starts, the score is started from 0, but unexpectedly, the scene will still stop when the user is playing when first time two nodes contact, so I really do not know what the problem is now.
Note that, why would I said that the problem is the Game Center, because when I do not connect the internet , everything goes smoothly, which means I will not add the score to the Game center. But strange again, so I guess that the problem must be adding score to the GameCenter, so I comment out all the method that will add score to the game center, so I guess now everything is fine now, but , the problem is still happen, so now nothing I can do, So why this problem, did any one of you met this problem before?
My code:
let' if collision == physicsCategory.basket4 | physicsCategory.bugnode { if contact.bodyA.categoryBitMask == physicsCategory.basket4 { contact.bodyB.node?.removeFromParent() } else{ contact.bodyA.node?.removeFromParent() } scoreama++ println("get teh shittttttttttttttttttttttttt") scoreLabel.text = "(scoreama)" finalScore1.text = "(scoreama)" showScore() } '
If you call the Game Center function from GameScene then bring the game center code to GameScene and change 'view' to 'self.view!'. It should then work!
I am displaying an iAd Banner at the top of my game and game center notifications are covering the iAd. Is there any GameKit framework delegate code that will let me know when a GameCenter banner is sliding onto my view so I can also slide my iAd down and then back up so the advertisement isn't covered.
No, there is no delegate method that notifies you when a Game Center banner will appear. Also keep in mind that what you're trying to do can disturb the user's game experience. I can tell you from personal experience that ads are pretty useless when users don't play your game regularly. 'Less is more' definitely applies to the implementation of mobile ads.
However, there are some methods/properties that can disable the game center banners. This gives you the opportunity to create your own custom Game Center UI. This information be found in Apple's Game Center Programming Guide: https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/GameKit_Guide/Introduction/Introduction.html .
Keep in mind that this is no small undertaking. You'll have to handle all the Game Center features, like achievements and challenges, separately. But it's your best shot at handling the obtrusiveness of Game Center notifications.
If you don't want to write your own Game Center UI, consider placing your iAd banner at the bottom in parts where the notifications are most intrusive.
I have spritekit game, Ad is preloaded on each start of game with [UIViewController prepareInterstitialAds]; And after gameover it should display ad with [self.view.window.rootViewController requestInterstitialAdPresentation]; and it's works okay, but only first time. The ad's shows only one time. After failing another game, ad do not show though preload. Any suggestions?
Do you have it set up to where it runs
[self.view.window.rootViewController requestInterstitialAdPresentation];
each time the game ends?
See the answer by gj15987 here...
requestInterstitialAdPresentation Works only one Time
He says there's a two minute block out period. I tried it and found it took 3min 20sec to allow another ad for me. I have fill rate set to 100% in the Developer section of Settings.
From the doc :
"The second major difference between a banner view and an full-screen advertisement is that the full-screen advertisement does not cycle through new content. An full-screen ad object loads a single advertisement; once that content expires, your app must release the ad object. Each time your app needs to show a new advertisement, it must explicitly create a new ad object."
straight from the horse's mouth :
iAd Programming Guide : Full-Screen Advertisements
I've already implemented auto-matchmaking, and tested it between two actual devices with different game centre accounts, so I know I've setup that part correctly: I can create a match, and send data between both the players. Now I'm implementing the invitations part.
The Game Center programming guide
says:
The playersToInvite parameter is non-nil when your game is launched
directly from the Game Center app to host a match. This parameter
holds an array of player identifiers listing the players to invite
into the match.
What I don't understand, is how to invite players through the game centre app. In the game centre app, I can see my game. When I click on it, in the top right corner there is a button with text: "..." . When I click on it, I see two options: "Play" and "Share". Clicking on "Play" launches my app.
Is there some code I need to implement for the Game center app to present me with the option of selecting friends to invite etc?
EDIT: It appears that the person in this post has almost the same problem as me:
Definitive answer to what playersToInvite is for
But no definitive answer so far, on how that data gets populated.
There are actually a couple of problems, both of which are on apples end:
The documentation is not up to date. While it mentions to use [GKMatchMaker sharedMatchMaker].inviteHandler , it has actually been deprecated in iOS 7, but the documentation has not been updated to reflect this.
It appears that there is no way you can invite players from the Game Center app. The documentation is incorrect in this case - the game centre UI does not provide any way for selecting the players. You invite players using the matchmaking view controller provided by game center.
Instead of using GKMatchMaker.inviteHandler, one can implement GKLocalPlayerListener - but this hasn't been documented properly in the Game Center Programming guide. It is easy to implement as there are only two methods, and work in almost the same way as the deprecated handler.
EDIT: There is a way to invite players from the game center app, but currently there is a bug in iOS 7, so that the game center app's flow in production, does not match the flow in the sandbox. As a result, one must navigate a much more cryptic flow to find the option to invite a player through the game center app. Currently only one player can be invited through the game center app, even if your app supports more than two players.