Skip to content

Quick and Easy way to check network connection using Blocks or Delegate.

License

Notifications You must be signed in to change notification settings

shams-ahmed/SANetworkTester

Repository files navigation

SANetworkTester

Version Platform GitHub license

SANetworkHelper makes your life easier to test network connection on a iOS device without having to spend time writing lots of code. Its has a few simple class methods that run in a background thread and return the response of the network by either using Block or Delegate.

Example method with Block:

[SANetworkTester googleDNSWithCompletion:^(NSNumber *response) {
    // handle success
    [self showAlert:[NSString stringWithFormat:@"Received %@ packets", response]];
    
} errorHandler:^(NSString *address, NSError *error) {
    // handle error
    [self showAlert:[NSString stringWithFormat:@"Failed %@ wError: %@", address, error.localizedDescription]];

}];

Example method with Delegate:

  1. #import < SANetworkTester.h >
  2. add Delegate to class:
  3. add two optional protocol methods: - (void)didFailToReceiveResponseFromAddress:(NSString *)address withError:(NSError *)error; and - (void)didReceiveResponse:(NSNumber *)response;
  4. add method to run test: [SANetworkTester googleDnsWithDelegate:self];

Screenshot

Usage

To run the example project; clone the repo, and build the exmaple project.

Communication

  • you need help, use Stack Overflow. (Tag 'SANetworkTester')
  • you'd like to ask a general question, use Stack Overflow.
  • you found a bug, and can provide steps to reliably reproduce it, open an issue.
  • you have a feature request, open an issue.
  • you want to contribute, submit a pull request.

Installation

SANetworkTester is available through CocoaPods, to install it simply add the following line to your Podfile:

pod "SANetworkTester"

Or directly drag and drop the Source folder and add these framework: 'CFNetwork', 'MobileCoreServices', 'SystemConfiguration'

Author

shams-ahmed, [email protected]

License

SANetworkTester is available under the MIT license. See the LICENSE file for more info.

Bitdeli Badge

About

Quick and Easy way to check network connection using Blocks or Delegate.

Resources

License

Stars

Watchers

Forks

Packages

No packages published