I've been trying to get the iOS SDK working in a new app. The app targets iOS 5.1.
HOW I GOT TO THIS POINT
Initially I simply added the SDK as a library (dragged all the files into my project) and received 30+ compiler errors (Xcode stopped counting shortly after 30). Most errors were related to my app's usage of Automated Reference Counting. After digging around I determined that the best approach (please feel free to correct me if this is wrong) was to build the SDK as a static library.
After mucking around with the build.config and build.sh files to revise them from 4.3 to 5.1, I was able to successfully build it.
I added all of the .h files and the newly created libANMobilePaymentLib.a.
I added #import "AuthNet.h" to the top of the class I want to call it from (specifically, ViewController.h).
So far, so good. No errors.
WHERE I HIT A WALL
In ViewController.m, I added the following line to my init:
[AuthNet authNetWithEnvironment:ENV_TEST];
This produced 2 errors. Here is the print out:
Ld /Users/marioparise/Library/Developer/Xcode/DerivedData/smr-eethymwozobssbdumgpocjynucke/Build/Products/Debug-iphoneos/smr.app/smr normal armv7
cd /Users/marioparise/Desktop/Xcode/smr
setenv IPHONEOS_DEPLOYMENT_TARGET 5.1
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk -L/Users/marioparise/Library/Developer/Xcode/DerivedData/smr-eethymwozobssbdumgpocjynucke/Build/Products/Debug-iphoneos -F/Users/marioparise/Library/Developer/Xcode/DerivedData/smr-eethymwozobssbdumgpocjynucke/Build/Products/Debug-iphoneos -F/Users/marioparise/Desktop/Xcode/smr -F/Users/marioparise/Desktop/Xcode/smr/smr -filelist /Users/marioparise/Library/Developer/Xcode/DerivedData/smr-eethymwozobssbdumgpocjynucke/Build/Intermediates/smr.build/Debug-iphoneos/smr.build/Objects-normal/armv7/smr.LinkFileList -dead_strip -lxml2 -fobjc-arc -miphoneos-version-min=5.1 -framework SystemConfiguration -framework UIKit -framework Foundation -framework CoreGraphics -framework MapKit -framework CoreLocation -o /Users/marioparise/Library/Developer/Xcode/DerivedData/smr-eethymwozobssbdumgpocjynucke/Build/Products/Debug-iphoneos/smr.app/smr
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_AuthNet", referenced from:
objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any thoughts on what I'm doing wrong? Is my whole approach off?
Any help would be much appreciated!!!
04-19-2012 11:50 AM
This is something that I wasn't able to answer myself, so I talked to one of our iOS developers about the issue. It sounds like the most likely problem is that the library is not being correctly linked. You'll want to make sure that your project file that you've added the library as a selected target. You'll also need to make sure that libANMobilePaymentRelease.a is present as a binary link in the project build phases.
04-27-2012 01:30 PM
Hey
Can you tell me what changes to did to the build.config and biuld.sh to make it work. I have been struggling a lot but I am getting all kinds of error. When I run the build.sh I get the error libxml2/tree.h not found. How do I get around this?
Any kind of help is much appreciated.
Regards.
10-30-2012 02:36 PM