Implementing Achievements in iOS App without Game Center - ios

Is there anyway possible to implement challenges and achievements in an app without using Game Center. The current app that I'm working on is not a game, but has challenges and achievements based on photo users submit. For example if a user uploads a photo of their pet, they get 50 points for submitting that picture.

You can use that, I create a simple class for iOS game center in GitHub
https://github.com/DaRkD0G/Easy-Game-Center-Swift

I would recommend having an if statement (or something like that) set up, and whenever the user "completes" the achievement, it changes a value on your server to "completed", and adds the number of points earned from the achievement to the user's overall points. If you already have a database storing user account data, you could add fields for the achievements. Then when the app loads the "achievements" page, you could just check the server real quick and display the results.

Related

iOS app user id without permanent device ID

I have an application (not a game) and the application store some data in server database for the user, so I need a user id to work with.
Since I cannot have a permanent id in ios devices now, I used the google play games login approach.
The user opens the application and gets redirect to safari where he logs in google and returns to the application and I use the google play games ID for identifying my user.
My binary got rejected because of this, so I can use the iOS game services, but it's not a game, so I'm worried to get rejected again, any one used ios game services just to get an identifier for the user in a non-game app before?
Here is the reject message
We noticed an issue in your app that contributes to a lower quality user >experience than Apple users expect:
Upon launching the app, a web page in mobile Safari opens for logging in, then >returns the user to the app. The user should be able to log in without opening >Safari first.
Any other approaches to get an identifier for a user without having to open a browser window at launch?
It will be best if the user does not have to enter a username or password for registration.
Any help is greatly appreciated.
This is a common scenario on iOS. Many apps, such as Angry Birds, requires registering with them or using a third party login such as Facebook, or sometimes a Game Center ID, if you want to ensure you won't lose your data upon uninstall of app.
So, it's typical to use the app vendor ID to identify the user server side until the point you have another ID to identify them.
Of course, the vendor ID is reset upon uninstalling/reinstalling the app. The Game Center ID is unique per app, but consistent between installs, so it seems like the Game Center ID is what Apple would prefer you to use.
From Working with Players in Game Center:
Player Identifier Strings Uniquely Identify Players
Every player
account is uniquely identified by a player identifier string contained
within a GKPlayer object. The identifier string is created when the
player’s account is first created and never changes, even if other
information in the account changes. Thus, player identifiers are the
only reliable way to track a particular player. For this reason, the
Game Kit API uses player identifiers wherever a specific player needs
to be identified. If Game Center needs to identify a specific player
in your game, the Game Kit API returns that player’s identifier. Your
game uses a player identifier to retrieve information from Game Center
about that player.
In addition to using player identifiers in your interactions with Game
Center, your game should also use the player identifier whenever it
wants to store data locally about a specific player. For example, if
your game stores data to track a player’s progress (such as on the
device, on your own server, or on iCloud), use player identifiers to
distinguish between multiple players playing on the same device. That
way, if a different player signs into the device, you can immediately
personalize the experience by showing content specific to that player.
Losing progress when uninstalling is standard behavior. Saving progress even after uninstall or sharing progress between devices by registering or logging in is a bonus.

How to implement an ios app with facebook leaderboard?

I have a simple iOS app, which contain a score system.
I want to upload the score to Facebook leaderboard and compare with friends.
How can I do it?
I have no experience in this category.
So please help me.
More detail:
I have completed a simple ios game, which would save the best score got by player.
I want to create a leaderboard of the score on facebook,like game center.
so the score can be upload to the leaderboard shown on facebook.
Have a look here https://developers.facebook.com/docs/games/mobile/ios-tutorial/#opengraph for an introduction of the integration of iOS games and Facebook, and here https://developers.facebook.com/docs/games/scores for the explanation how to use the OpenGraph Scores API.
There is also an Achievements API which yoou could use: https://developers.facebook.com/docs/games/achievements/
As far as I know, results can only be queried for the User who gave the Access Token, respectively the User's friends. So, an overall leaderboard cannot be generated via these mechanisms.
Additional helpful links:
https://developers.facebook.com/docs/games/mobile/bestpractice
https://developers.facebook.com/docs/games/opengraph/
https://developers.facebook.com/docs/graph-api/reference/app/#scores

Understanding Game Center Sandbox

I am trying to see submitted scores in sandboxed leaderboard. For iOS5 I read that 2 accounts are required to submit scores.
Now what I don't understand is whether I should see more than 1 players played the game. For now, all my efforts lead me to see only #1 of 1 player in leaderboard list and I see "no scores".
In other words, should sandboxed environment ever show more than 1 player?
Details are below:
Using iOS5
Created 3 different accounts and submitted scores from them
Accounts have e-mails verified
Tried on Simulator and iPad
Tried both, developer and distribution certificates
Waited more than 24 hours
Checked from Game Center app and from Game Center view controller inside my app.
Can see my score if I run my app on iOS 6
What else I should do to see submitted scores on iOS5 in leaderboard?
Potentially 2 things to check. First is the time scope of the scores you are pulling. Is it set to "GKLeaderboardTimeScopeAllTime"?
The second is the player scope. Do you have it set to "GKLeaderboardPlayerScopeGlobal"?
GKLeaderboardTimeScopeAllTime is a default value. so it doesn't matter wether U set it or not=) check it out in documentation ))

Good Practice to save game center data (GKTurnBasedMatch)?

I am making a game app with game center.
I would like to ask what is the good practice for saving game data like whole object (GKTurnBasedMatch) in app?
Since, there is matchData for each of the match. I am planning to save this GKTurnBasedMatch in NSDefault , however no luck for retrieving it from the nsdefault. So, is there any good way to do so ?
Could you guys please give me some advises? my consideration is only what if i update the app , would NSDefault data be deleted after the app update?
It's not good practice to store these objects at all. The "truth" for Game Kit is at Game Center, so your app should be retrieving the latest information from Game Center to ensure everything's up to date. Imagine if your user has two different devices, and makes progress on a game on one device; if the other device is relying on shared state then it would miss out on the updates.
When your app launches, use +[GKTurnBasedMatch loadMatchesWithCompletionHandler:] to find out what matches are currently in progress. If you need to store custom data with the matches, store it in the matchData property on the match so that it's synced with Game Center.
If you want to support some kind of limited offline display, I'd take the properties you need to be able to show and store those associated with the match ID (so you can match it back to a live match when you get reconnected to Game Center. For example, you could store the match participants' names and the current message. Those are all just strings, so you could easily them with the match ID in user defaults.

iOS: can game center account somehow be used for authentication on custom webservice?

Let's say we wan to have a custom backend for a iOS game that manages user accounts and allows the users to send objects to each other, but we don't want to actually have the user to create a dedicated useraccount for our game. It would be possible to simply use the playerID for the usermanagement, but that would not be secure. Is there any way to use a local gamecenter authentication to also authenticate at a custom webservice?
Currently i ponder about how the game 'pocket frogs' enables the players to send gifts to gamecenter friends. Gamecenter doesn't seem to provide this functionality so i assume they use a custom backend for it, but how can such a backend authenticate the player?
I can't say for sure if this is how Pocket Frogs (PF) does it, but based on the fact that only Game Center (GC) friends who also play PF appear on the neighbours list, I think it may work like this:
When a player first starts the game, they get a user id (a 32-bit int, say) from the PF back end which is stored locally. Once the player has this id it can be stored in one of the GC leaderboards under the GKScore context property rather than the value. As far as I can see, PF automatically adds every player to all of the leaderboards pretty much straight away.
Then when another player wants to send a gift, PF gets the leaderboard scores for all of their GC friends and if they have a valid score they must be a PF player and the context value can be read to get their PF id.
In this way the PF back end gets the correct id, but doesn't need to use their GC id.
Incidentally, I tried out the idea of using challenges for sending gifts, and it can work. See http://www.lrgdigital.com/ofgame.html for the game I tried it with - you have to win a game before you can gift it. It has the benefit that you can send the gift to anyone on your friends list rather than only friends who play the game, but there are some limitations as well.
No. Gamecenter uses apple id and that is off limits for obvious reasons. And if you look into the game center framework, there is a way to get gamecenter friends.
Look here to see how to get an array of friends: Game Center Friend List

Resources