0

I'm trying to add Internet access to my application and in order to do this, I am testing to see whether or not the user is connected to a Wifi/3G network. To do this, I followed Apple's Reachability sample code and added Apple's Reachability.h and Reachability.m to my project. When I try to run the project at this point (I haven't even added any code accessing the Apple's Reachability files), I get 13 errors. This seems normal, as I have not yet added the SystemConfiguration framework to my project, but when I do add it, I still get the same errors, making me wonder if I'm adding frameworks correctly.

To add the framework, I went to... Project > Targets > Build Phases > Link Binary with Libraries > The + Button > Add SystemConfiguration. Framework

Has anyone else had this issue and figured something out?

Images of Errors showing "Automatic Reference Counting Issue"

http://farm8.staticflickr.com/7034/6461498873_5faeae2db3_b.jpg http://farm8.staticflickr.com/7017/6461499405_1e679067e2_b.jpg

Josh Crozier
  • 233,099
  • 56
  • 391
  • 304
iMinichrispy
  • 15
  • 1
  • 5
  • The issues you are experiencing are actually not connected to the addition of the missing framework/s but to ARC. Your project uses ARC but Reachability as provided ages ago by apple is not built for ARC. You should by the way not use Apple's Reachability but the drastically improved version contained within ASIHTTPRequest. – Till Dec 05 '11 at 19:56
  • All I'm doing is checking for a Wifi connection, how does using ASIHTTPRequest make it better? Thanks for the reply. – iMinichrispy Dec 05 '11 at 20:04

1 Answers1

1

These are ARC errors, your project appears to be set to use ARC but the Reachability classes are not written to support ARC, you will need to disable ARC for Reachability.m

See how to do that here, How can I disable ARC for a single file in a project?

Community
  • 1
  • 1
Chris Wagner
  • 20,773
  • 8
  • 74
  • 95
  • Thanks, that seems to have solved most of the problems, but I still have 4 issues relating to the code where I actually use the Reachability files: http://farm8.staticflickr.com/7169/6461588793_bf82c30e43_b.jpg – iMinichrispy Dec 05 '11 at 20:03
  • What version of Reachability are you using? I don't see `sharedReachability` as a class method for what Apple provides, http://developer.apple.com/library/ios/#samplecode/Reachability/Listings/Classes_Reachability_h.html#//apple_ref/doc/uid/DTS40007324-Classes_Reachability_h-DontLinkElementID_5 – Chris Wagner Dec 05 '11 at 20:08
  • I see the problem, my code is based off the 1.5 version of the sample code, but the actual Reachability files I have in my project are from version 2.2. Thanks for the help. – iMinichrispy Dec 05 '11 at 20:13