Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Yes, you can use a class provided by Apple called Reachability to verify the internet connection status, and NSNotificationCenter to keep waiting for any internet connection status. Thus, you could send the scores to your mysql database using the methods described above by @trojanfoe.</p> <p>To verify internet status first check if any host is reachable, if it is, we understand that there is an internet connection:</p> <pre><code>- (BOOL)verifyInternetStatus { Reachability *reachable = [Reachability reachabilityWithHostName:@"www.google.com"]; NetworkStatus internetStatus = [r currentReachabilityStatus]; if (internetStatus == NotReachable) { // there's not internet connection, therefore we save the scores locally } else { // send the scores to the database } } </code></pre> <p>When the internet status changes, Reachability class notifies to its observers through NSNotificationCenter that internet status has changed using the key <code>kReachabilityChangedNotification</code>. So, you need to add your class as an observer of this key:</p> <pre><code>[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(verifyInternetStatus:) name:kReachabilityChangedNotification object:nil]; </code></pre> <p>This is one way to doing so. When you want to send the score, call the method <code>verifyInternetStatus</code> it will send the score or will save it locally.</p> <p>I hope it helps.</p> <p><strong>EDIT:</strong></p> <p>Sorry, i've forgot the class:</p> <p><a href="https://developer.apple.com/iphone/library/samplecode/Reachability/index.html" rel="nofollow">https://developer.apple.com/iphone/library/samplecode/Reachability/index.html</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload