Objective:
To check whether internet connection exists in the device or not.
Approach:
Most apps use active internet connection to call and pass the data.so it's always important to check the internet connection availability at the first place.
Solution :
To do that,import SDK from -//github.com/preetlotey999/Reachability-Class-For-iOS.git
Download the .Zip file and add to our project.
import header file(reachability.h) into the project.
Since third party libraries,frameworks haven't updated to automatic refrence counting,we will encounter memory problems.so to disable arc for single file, do the following:
1.In the project navigator(left panel)click the project header;
2.Click build phases tab;
3.Expand the compiler sources;
4.Double click the source file that you wish to disable ARC.
5.Add-fno-objc-arc in the popup.
Now it's a simple process.
1.create an instance for the reachablity class;
2.check network status;
Conclusion:
It's always important to check the internet connection before hand instead showing at the last .So with this simple lines of codes we can make that possible,i believe this can come in handy at many places.
To check whether internet connection exists in the device or not.
Approach:
Most apps use active internet connection to call and pass the data.so it's always important to check the internet connection availability at the first place.
Solution :
To do that,import SDK from -//github.com/preetlotey999/Reachability-Class-For-iOS.git
Download the .Zip file and add to our project.
import header file(reachability.h) into the project.
Since third party libraries,frameworks haven't updated to automatic refrence counting,we will encounter memory problems.so to disable arc for single file, do the following:
1.In the project navigator(left panel)click the project header;
2.Click build phases tab;
3.Expand the compiler sources;
4.Double click the source file that you wish to disable ARC.
5.Add-fno-objc-arc in the popup.
Now it's a simple process.
1.create an instance for the reachablity class;
2.check network status;
Conclusion:
It's always important to check the internet connection before hand instead showing at the last .So with this simple lines of codes we can make that possible,i believe this can come in handy at many places.
No comments:
Post a Comment