GKScores are stored until next connection? - ios

In Apple's GKLeaderboards sample code they show how to store GKScore objects for later submission when they fail to send. However, the documentation for Reporting Scores To Game Center says "If for some reason the score could not be reported because of a network error, Game Kit automatically resends the data when the network becomes available."
Does this mean that the resend infrastructure in GKLeaderboards is no longer necessary? In which version did GameKit start saving and resending scores to the leader board?
I haven't used GameKit until just recently, so I'm hoping someone has been using it for a while and can confirm it to save me some testing.

In my experience I've never had to implement coeds to resend scores that were not able to be sent when a connection was down!
All data shows that with the automated resending, you and I no longer have to resend the data manually! :)
That's a relief.

Related

do I need to resubscribe to market data after reset?

I am using quickfixj to subscribe to market data. Noticed that after midnight reset, I will not receiving incremental anymore. How do I know if I am still subscribed to the the session?
Do I need to resubscribe each time when I logged on again?
It of course depends on the target system that you're connecting to. Some systems will maintain subscriptions across sessions, but the vast majority will not.
You probably need to resubscribe.
This is a bit late, but I figured out that I need to resubscribe. Since the initiator is not down but the acceptor is down at that period of time. When Accepter started, the initiator was still trying to connect, once connected, the subscription is not triggered.
So the solution is to add subscription in the onLogon callback, so each time it got logged on, it will try to subscribe again, so the stream is not lost.

Watch Connectivity: Transfer user info when phone not nearby

I am trying to transfer data from Apple Watch to iOS. I use transferUserInfo to do so. It is very likely that, when I call that method, the phone is not nearby (and therefore not reachable).
As far as I understood the documentation, the user info should be queued and delivered to the phone by Watch Connectivity when the phone becomes reachable again. This does not seem to be true for me, instead my session delegate's session(didFinish:error:) gets called with a Transfer timed out. error.
This is bad since that means the watch app and iOS app need to be active at the same time in order for iOS to receive the latest info. Is this expected behaviour, and is there any way to fix this?
I know that application context might have the behaviour I need, but the message size for application context is pretty limited, which might be an issue for me if the iOS app is not opened for a while (I am transferring workouts, so they might accumulate on the watch).

How to keep GKMatch connection alive

I have a game, working with GameKit and using the Apple Game Center to manage the connection and messages.
When I am testing the software there is no issue with the connection, but once I am playing with another user over the internet the player is very often disconnected suddenly.
I would like to implement a simple method to reconnect the player or avoid to get the disconnected state from Game Center.
I was trying the solutions suggested at several forums and by the iOS documentation too, but all these are operating with sending a re-invite message to the user which is not really a nice solution.
I would like to have something like automatically waiting for the other user at least for 30 seconds or a minute before the game would tell that the player is disconnected finally.
Sometimes the disconnected message is coming very quickly after a normal data message, sent by the game itself, so it is not really clear why this happens.
Could someone has a good solution for this issue?

How to replicate Apple mail app upload que when no connection is found

If you try to send an email using the iOS mail app when your device has no connection it will que up the message to send when the device finally finds a connection, even if the app is backgrounded. You can hear that whoosh sound when it sends the message.
Does anybody know how that app gets around the background restrictions from apple? I’ve been reading through apples documentation on background execution but I can’t see anything that lets me do anything even remotely similar. NSURLSession lets me continue an upload tasks in the background for a short period of time but nothing that lets me que up an upload if I can’t make a connection to begin with.
Is Apple able to get around this because they aren’t bound by the same restrictions as we are?
You can implement some sort of persistent retry store and use: application:performFetchWithCompletionHandler: to send it.
Apple do not state specifically when they will wake you up and give you the opportunity to send it they simply state -
When an opportunity arises to download data, the system calls this method to give your app a chance to download any data it needs.
Try to experiment with this and see if regaining connectivity calls this.

Iphone - Notify from the server to the client when an event occurs

im stuck in a situation
SITUATION : I have a situation wherein i answer some questions and get points according to the answered questions. if my points become say 10 i win some gift using a QRCode. (there is a qr code that is generated to the user, and when the qrcode is scanned from someother device which has a scanner app or any other scanner, it gives a link to that online store. This link can be opened from any browser.) The gift is accessed from some online store by scanning the QRCode which gives a link to that online store with some unique id and when the gift is accessed/taken the server is notified that the gift is accessed/taken from that online gift store and the QRCode status is updated to invalid on the server database. Now once the server gets the notification that the gift is being accessed/taken, the server should immediately notify my iphone app that the gift is received so that i can immediately show another congratulations image or something.
POSSIBLE SOLUTION : i thought of one possible solution wherein i check upon the qrcode access status change on the server every say 60 secs and display the image accordingly. I dont know how efficient/correct this way would be though.
ISSUE : but before i refuge to the above solution, i want to know, can this notification happen from the server without my app trying to call or fetch the update from the server? I mean, my app comes into the picture only after the server sends a notification in the form of a msg or some xml or something..
Any help would be deeply appreciated.
You can open a connection to your server using CFReadStream, add the stream to your runloop and set up a callback function. Whenever the server writes data to the open connection, your callback will fire and you can then read from the stream to get the data the server sent
More info here: https://developer.apple.com/library/mac/#documentation/Networking/Conceptual/CFNetwork/CFStreamTasks/CFStreamTasks.html
You could try to check Push Notifications. But it's impossible to determine on server side if notification was received on client side or not (if you won't implement it by yourself, but you'll probably wont cover all the possible situations, like when your app is not launched and notification came).
you can try to use XMPP protocol, which is most commonly used for chats/mails, where the changes in the server is notified to the clients.
Apple Push Notification Service is meant to solve these types of situations.
Hope it helps:
Apple Docs: http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ApplePushService/ApplePushService.html#//apple_ref/doc/uid/TP40008194-CH100-SW9
There is a nice tutorial: http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12
Video tutorial: http://www.youtube.com/watch?v=cKV5csbueHA&feature=relmfu

Resources