I have a question about GKScore. There is a method called report(_:withCompletionHandler:). What happens if you lose your Internet connection. Do I need to save my score and submit it later? Or the method itself solves it. Is it not automatically sent in the background? Thanks in advance
Does method report(_:withCompletionHandler:) send score even if your internet connection was lost?
77 views Asked by psrajer At
2
There are 2 answers
0
On
Yo can try it putting the plane mode.
But if you try to call this method without internet it will return an error.
You could get the internet connection status using the reachability. If you use Alamofire it have integrate a very good reachability system.
If your game need internet to play you can block your principal screen using:
import Alamofire
extension NetworkReachabilityManager {
static var isConnectedToInternet: Bool {
return NetworkReachabilityManager().isReachable
}
}
Else you can save your request to send it when you have internet. The NetworkReachabilityManager will send you a notification when internet was enable and disable.
From Apple's Game Center programming documentation:
So you don't have to do anything. Reference to the docs is here.