Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Dec 24, 2011, 10:59 PM   #1
ArtOfWarfare
macrumors 68040
 
ArtOfWarfare's Avatar
 
Join Date: Nov 2007
Send a message via Skype™ to ArtOfWarfare
Reachability giving errors during compile...

I'm using Reachability.h/m in my project to determine whether or not the user has a network connection.

It was initially complaining about ARC, so I turned off ARC for the file, and that got rid of about half the errors, but it's still giving me errors about

"Apple Mach-O Linker (Id) Error"

Code:
Undefined symbols for architecture i386:
  "_SCNetworkReachabilitySetCallback", referenced from:
      -[Reachability startNotifier] in Reachability.o
  "_SCNetworkReachabilityScheduleWithRunLoop", referenced from:
      -[Reachability startNotifier] in Reachability.o
  "_SCNetworkReachabilityUnscheduleFromRunLoop", referenced from:
      -[Reachability stopNotifier] in Reachability.o
  "_SCNetworkReachabilityCreateWithName", referenced from:
      +[Reachability reachabilityWithHostName:] in Reachability.o
  "_SCNetworkReachabilityCreateWithAddress", referenced from:
      +[Reachability reachabilityWithAddress:] in Reachability.o
  "_SCNetworkReachabilityGetFlags", referenced from:
      -[Reachability connectionRequired] in Reachability.o
      -[Reachability currentReachabilityStatus] in Reachability.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any suggestions?
__________________
Battery Status - On the Mac App Store
The only app that'll estimate when your wireless devices will need their batteries changed.
Like it on Facebook!
ArtOfWarfare is offline   0 Reply With Quote
Old Dec 25, 2011, 10:21 AM   #2
PhoneyDeveloper
macrumors 68020
 
PhoneyDeveloper's Avatar
 
Join Date: Sep 2008
These are linker errors. You've forgotten to add the framework that has those symbols in it.
PhoneyDeveloper is offline   0 Reply With Quote
Old Dec 25, 2011, 12:06 PM   #3
ArtOfWarfare
Thread Starter
macrumors 68040
 
ArtOfWarfare's Avatar
 
Join Date: Nov 2007
Send a message via Skype™ to ArtOfWarfare
Oh!

Thank you! I copied and pasted reachability from one project to another but forgot to make sure all the frameworks were there. Thanks!
__________________
Battery Status - On the Mac App Store
The only app that'll estimate when your wireless devices will need their batteries changed.
Like it on Facebook!
ArtOfWarfare is offline   0 Reply With Quote
Old Dec 26, 2011, 07:32 PM   #4
North Bronson
macrumors 6502
 
Join Date: Oct 2007
Location: Los Angeles
Quote:
Originally Posted by ArtOfWarfare View Post
I'm using Reachability.h/m in my project to determine whether or not the user has a network connection.
Are you using Reachability only to determine if a network connection exists?

Try connecting to the network and downloading whatever resource your application is interested in. The NSURLConnection APIs will give you an error if the connection fails. That error will tell you if there was no network connection.

This is going to be more efficient than using Reachability in your application. Reachability is useful some of the time. It is not a good idea if your only goal is to find out if a connection exists.
__________________
North Bronson Software
North Bronson is offline   0 Reply With Quote
Old Dec 26, 2011, 11:06 PM   #5
ArtOfWarfare
Thread Starter
macrumors 68040
 
ArtOfWarfare's Avatar
 
Join Date: Nov 2007
Send a message via Skype™ to ArtOfWarfare
Quote:
Originally Posted by North Bronson View Post
Are you using Reachability only to determine if a network connection exists?

Try connecting to the network and downloading whatever resource your application is interested in. The NSURLConnection APIs will give you an error if the connection fails. That error will tell you if there was no network connection.

This is going to be more efficient than using Reachability in your application. Reachability is useful some of the time. It is not a good idea if your only goal is to find out if a connection exists.
I'm using it before sending a request to Apple's servers information on items available for In-App Purchase... if I simply sent it and didn't get a response, that wouldn't say whether the issue was a lack of a connection or a failure elsewhere.
__________________
Battery Status - On the Mac App Store
The only app that'll estimate when your wireless devices will need their batteries changed.
Like it on Facebook!
ArtOfWarfare is offline   0 Reply With Quote
Old Dec 26, 2011, 11:21 PM   #6
PhoneyDeveloper
macrumors 68020
 
PhoneyDeveloper's Avatar
 
Join Date: Sep 2008
Actually, the recommended strategy is to attempt to send the request. If it fails then check reachability. If the answer is "not reachable" then present that error to the user. Otherwise present the error that you received from your attempted request to the user.
PhoneyDeveloper is offline   0 Reply With Quote
Old Dec 26, 2011, 11:23 PM   #7
ArtOfWarfare
Thread Starter
macrumors 68040
 
ArtOfWarfare's Avatar
 
Join Date: Nov 2007
Send a message via Skype™ to ArtOfWarfare
Quote:
Originally Posted by PhoneyDeveloper View Post
Actually, the recommended strategy is to attempt to send the request. If it fails then check reachability. If the answer is "not reachable" then present that error to the user. Otherwise present the error that you received from your attempted request to the user.
I guess that makes sense.

I have a bigger issue though right now... my code is still not compiling and is still giving me the same errors as before. "SystemConfiguration.framework" has been added to my list of Frameworks, I've cleaned, restarted Xcode, and attempted to run, but got the same exact errors. Suggestions?

I'm noticing a warning
Quote:
Ignoring file [...]SystemConfiguration.framework/SystemConfiguration, missing required architecture i386 in file
Edit: Alright, I've got it working now.

The issue was the method I'd used to add the framework. The proper way of doing it was to go to the target, click on the build phases tab, and then add it to the list labeled "Link Binary With Libraries" (using the + button in the bottom corner.)
__________________
Battery Status - On the Mac App Store
The only app that'll estimate when your wireless devices will need their batteries changed.
Like it on Facebook!

Last edited by ArtOfWarfare; Dec 26, 2011 at 11:38 PM.
ArtOfWarfare is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
cisco VPNclient gives error 51 in new mbp thedangercometh Mac OS X 11 Mar 13, 2011 01:29 PM
compiling error -f68881 higeorge Mac Programming 2 Nov 16, 2010 01:31 PM
compile error when compiling objective c on windows srinivas.be88 MacBook Pro 0 Aug 18, 2010 01:41 AM
iTunes gives precedence to compilation artwork over song specific artwork jtheelen Mac Applications and Mac App Store 8 Sep 23, 2009 02:40 PM
Using objects in a for loop gives an error at compile LoveMyMac2004 Mac Programming 12 Sep 17, 2008 03:14 PM


All times are GMT -5. The time now is 08:41 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

Privacy / DMCA contact / Affiliate and FTC Disclosure
Copyright 2002-2013, MacRumors.com, LLC