- Create a header & an implementation class containing the sample code
- If you happen to be using PayPal as well as AuthNet in your code then you may run into some syntactical problems. To resolve any such issues, please have a look at this post on stackoverflow.
- When substituting values in the code, if you provide the "API Login ID" and "Transaction Key" as the name / password values in your call to AuthNet then you will run into the following error as seen in the logs:
- This fails as password and transactionKey are distinctly different variables in the header files.
- So make sure to substitute the sample code with the username and password used with https://developer.authorize.net/ or https://test.authorize.net/
- If you run the code at this point and end up calling loginToGateway, you will run into the following error logs:
- This is not the same as being at the point where you simply need to login to the sandbox (https://test.authorize.net/) and enable the new device. No, this is very different and you need to get past this to get to the next point. So you need to add some additional code which is talked about on the forums as well:
- Now you should be at a point where running the code results in the following error logs:
- This is more like it! So head over to https://test.authorize.net/ and enable your new device. Here are some screenshots: screenshot_1 and screenshot_2
- Sadly we aren't done yet, we see a message about the mobile device being ready for use but we also notice that the sessionToken has come back as null and therefore the next call's response displays an error ... claiming that the request content was incomplete:
- Even I don't have a solution past this point, feel free to follow this forum thread for any progress on the matter.
Showing posts with label iOS. Show all posts
Showing posts with label iOS. Show all posts
Saturday, March 24, 2012
AuthNet iOS Integration Part 2
There are quite a few gaps in the sample code provided by AuthNet, we will discuss the logs indicating the problem and what chunk of code needs to be added/removed to get to a complete sample that works. This blog entry assumes that you've cleared the challenges of adding AuthNet binaries to your Xcode project. If not then have a peek at AuthNet iOS Integration Part 1 before continuing.
AuthNet iOS Integration Part 1
- You can start with the official instructions to get an account with Authorize.Net and download their iOS SDK. Afterwards the instructions are bit out of date, so you can follow along below.
- After you download and unzip the SDK, you can move the files around to have them structured in this manner:
-
The structure above has the following pros:
- Clarity around which version has been downloaded and in use at any point of time: anet_ios_sdk-X.X.X
-
If you work long enough to have multiple versions, then having them in your repository (assumption - GIT repo) helps figure out any migration issues
- $(SRCROOT)/anet_ios_sdk-1.0.0/ANMobilePaymentLib/
- $(SRCROOT)/anet_ios_sdk-1.0.1/ANMobilePaymentLib/
- $(SRCROOT)/anet_ios_sdk-1.0.2/ANMobilePaymentLib/
- ...
- $(SRCROOT)/anet_ios_sdk-X.X.X/ANMobilePaymentLib/
-
Goto MyProject > Targets > Build Settings in Xcode and set:
-
Header Search Paths
- "${SDK_DIR}"/usr/include/libxml2
- Mark the Recursive checkbox as checked
- "$(SRCROOT)/anet_ios_sdk-1.0.0/ANMobilePaymentLib"
- "${SDK_DIR}"/usr/include/libxml2
-
Library Search Paths
- "$(SRCROOT)/anet_ios_sdk-1.0.0/ANMobilePaymentLib"
-
Other Linker Flags
- -lxml2
-
Header Search Paths
-
Drag & Drop the ANMobilePaymentLib.xcodeproj file from a Finder window into Xcode under MyProject.
- If you don't follow this step then you will face compilation issues like:
-
Goto MyProject > Targets > Build Phases in Xcode and set:
-
Link Binary With Libraries
- libANMobilePaymentLib.a
-
Link Binary With Libraries
- For a discussion on the fixes to the sample code, head over to AuthNet iOS Integration Part 2
Wednesday, February 22, 2012
CouchCocoa - An iOS client for working with CouchDB
CouchCocoa is a framework / library for iPhone use that abstracts out the work needed to talk to CouchDB instances running on the web or on the device itself.
If you want to jump right into the setup for a simple project, then simply follow these steps:
Aside from the process there are some "big picture" points to consider:
- Add CouchCocoa as a submodule to your project:
- cd ~/dev/myProject/
- git submodule add git://github.com/couchbaselabs/CouchCocoa.git
- Get all the dependencies of this submodule itself:
- cd ~/dev/myProject/CouchCocoa/
- git submodule update --init --recursive
- Drag & drop CouchCocoa's .xcodeproj file under your own project in Xcode
- Add the following as your target's dependencies so that they will get built:
- iOS Framework (CouchCocoa)
- iOS Library (CouchCocoa)
- Add the following in "Link Binary With Libraries" for your target:
- libCouchCocoa.a
- Add the following in "Header Search Paths" for your target:
- "$(SRCROOT)/CouchCocoa/Model"
- "$(SRCROOT)/CouchCocoa/REST"
- "$(SRCROOT)/CouchCocoa/Couch"
- "$(SRCROOT)/CouchCocoa/UI/iOS"
- In Xcode, select CouchCocoa.xcodeproj in the Project Navigator and edit the Target > Build Settings and set the Skip Install setting to Yes.
-
If at a later point of time you realize that you want to work with TouchDB as well then you *may* need to update your CouchCocoa submodule and bring it up to speed:
- cd ~/dev/myProject/CouchCocoa/
- git checkout touchdb
- git pull origin touchdb
Aside from the process there are some "big picture" points to consider:
- CouchCocoa can talk directly to CouchDB (or CouchBase - a more performant variant). For example, if you use the hosting services provided by IrisCouch, you can configure CouchCocoa to work directly with that Couch server.
-
CouchCocoa can work with an embedded version of CouchDB on mobile devices.
- TouchDB is one such implementation which is lightweight and exists for iOS and Android mobile devices.
- For iOS however, I do find it a bit confusing when I think about how to structure my project, there are two ways to do it:
-
Build and soft-link the TouchDB framework. And use CouchCocoa as a submodule as outlined earlier in the blog.
-
If you choose to use TouchDB-iOS as a submodule as well then don't forget that TouchDB's itself also needs a soft-link to CouchCocoa.framework:
cd ~/dev/superProject
ln -s ./DerivedData/superProject/Build/Products/Debug-ios-universal/CouchCocoa.framework ./TouchDB-iOS/Demo-iOS/Frameworks/CouchCocoa.framework
-
If you choose to use TouchDB-iOS as a submodule as well then don't forget that TouchDB's itself also needs a soft-link to CouchCocoa.framework:
- Syncpoint-iOS which bundles TouchDB and CouchCocoa together but lags behind the individual projects in terms of stability and features. To experiment with it, you can follow a this discussion thread where it was introduced to the community.
-
Build and soft-link the TouchDB framework. And use CouchCocoa as a submodule as outlined earlier in the blog.
- Another huge pain-point is the fact that for all of GitHub's glory it doesn't let me search for content in wiki pages so when it comes time to try out the infamous Grocery-Sync example, I'm left wondering where to look! This relative path should shed some light I hope: TouchDB-iOS/Demo-iOS/DemoAppDelegate.m
- For iOS however, I do find it a bit confusing when I think about how to structure my project, there are two ways to do it:
- Couchbase Mobile is another implementation. Recently it has seen some serious progress in terms of tutorials (one & two) and example-code covering its usage.
- TouchDB is one such implementation which is lightweight and exists for iOS and Android mobile devices.
Labels:
client,
CouchCocoa,
CouchDB,
iOS,
iPhone,
ObjC,
Objective C,
TouchDB
Thursday, October 20, 2011
HTML5 vs. Native Mobile Apps
Technologies that are enabling HTML5 to either deploy to multiple mobile platforms or keep-up with the native look:
- PhoneGap
- Sencha Touch
- jqTouch
- jQuery Mobile
- There is a minor issue in iOS that doesn't properly set the width when changing orientations with these viewport settings, but this will hopefully be fixed a a future release.
- It's not currently possible to deep link to an anchor (index.html#foo) on a page.
Subscribe to:
Posts (Atom)