3

I'd like to know if there is any possibility to check if the application is using a network connection now to do something.

The application has a background service which is uploading data and the user may also press a button to download data. I do not want this user to be able to download, until the background process is finished.

Does the framework provide something to check if the connection is used?

Oleg Danu
  • 4,010
  • 4
  • 26
  • 45

1 Answers1

0

I would suggest using BOOL property in your method where the background uploading codes are.

Then in your button's sender method, do something like this:

if (!upLoading) 
{
  // Your Downloading codes
}
else
{
  // Show an alert here 
}
Aniruddh
  • 7,398
  • 1
  • 23
  • 43
  • Sorry, but I'm not searching for any code suggestion like this. Just asking if there exists something in framework, which will tell me that, like Reachibility class, which may inform me of an available connection. – Oleg Danu Aug 30 '12 at 08:00
  • Check this: http://stackoverflow.com/questions/1083701/how-to-check-for-an-active-internet-connection-on-iphone-sdk – Aniruddh Aug 30 '12 at 08:11
  • Like I said, I don't need the Reachability example, as I know how to check if a connection is available. I need to see, if the connection is being used by the application, like, donwloading/uploading something. And that's all. – Oleg Danu Aug 30 '12 at 11:13
  • Very bad habbit of downvoting when someone trying to help you. – Aniruddh Aug 30 '12 at 11:55
  • Down-voting is legitimate if the answer is not answering the question at all. Also your answer just shows how to use a boolean to to take a decision which is an extremely basic bit of coding. As Oleg Danu said - he is asking about something that has nothing to do with this answer. It's not meant personally. Down-voting helps keeps this site as useful as it is! :) – RedYeti Dec 20 '12 at 13:00
  • Yes, but it doesn't mean that the person will post the whole workaround for you. I just wanted to give him a hint with an example code, that's what I did. – Aniruddh Dec 26 '12 at 08:24