Prima di inviare un messaggio (ad esempio chiamando setValue su un oggetto Firebase), esiste un metodo consigliato per determinare se l'utente è online o offline?Come rilevare se l'utente è online quando si utilizza Firebase iOS SDK
Ad esempio:
[firebase setValue:someValue withCompletionBlock:^(NSError *error, Firebase *ref) {
// This block is ONLY executed if the write actually completes. But what if the user was offline when this was attempted?
// It would be nicer if the block is *always* executed, and error tells us if the write failed due to network issues.
}];
abbiamo bisogno di questo nella nostra app iOS in quanto l'utente potrebbe perdere la connettività se entrassero in un tunnel, per esempio. Se Firebase non offre un modo integrato per farlo, ci limiteremo a monitorare l'API di Reachability di iOS.