Wednesday, March 28, 2012

Wrong Archive - "ios app archive" vs "generic xcode archive"

  • Everything in your life was fine and then one day when you decided to Archive your Xcode build as usual ... BAM! ... out of the blue, the end result turned out to be weird / different one than usual.
  • It almost seems wrong and on closer inspection you can surely tell that what used to work
    • had the archive type "ios app archive"
    • whereas the newer strange build results has the archive type "generic xcode archive"
  • The reason this is happening is because you've added a new framework(s) for which you need to edit the Target > Build Settings and set the Skip Install setting to Yes. Afterwards the "Archive" process will start producing normal end results again.

Monday, March 26, 2012

How to combine: IrisCouch to CouchCocoa to RestKit to CoreData to TouchDB?

  1. MagicalRecord has good reputation as a framework that further abstracts CoreData goodness. So when thinking about the "RestKit to CoreData" piece, it is only natural to get excited about news like: RestKit is built, in part, on top of MagicalRecord !!!
  2. CoreData is desirable because of classes like NSFetchedResultsController.h which help to efficiently manage the results returned from a Core Data fetch request. Have a look at the comments for that class and it makes its own usefulness painfully apparent.
    • Now CoreData is built upon DataSources such as SQL-lite so I feel that there is an inherent difference in the query language of CoreData which has been written for relational databases versus nosql DBs like CouchDB … but I could be wrong about this and need to collect the opinions of others in the dev community on this matter.
    • If all I'm worried about is the smoothness with which a UITableView updates when used solely against an embedded CouchMobile/TouchDB/SyncPoint instance then I should get and see what it the user experience for the GrocerySync app feels like.
      • Look at CouchUITableSource
      • Based on https://github.com/couchbaselabs/TouchDB-iOS/wiki/FAQ:
        • Couchbase Mobile 2.0 is implemented in an interpreted language (Erlang) whose runtime library needs to be bundled in. This make me think that IF CouchCocoa is the client interfacing with it then CouchUITableSource ends up helping out the same way as NSFetchedResultsController.
        • TouchDB is inherently different because it’s using SQL for storage, rather than a custom append-only B-tree implementation. Does this mean that it far better suited for a head on CoreData integration + optimization? *Shrug* ... anyway CouchUITableSource is still there to help for now.

Upgrade from Xcode 4.2 to 4.3

  1. After installing Xcode 4.3 via the App Store you may feel like you're finished.
  2. But the process is not yet complete and you'll be surprised if you keep using the Xcode icon in your dock to launch, as there will be no apparent changes to Xcode.
  3. As pointed out in this blog, the key is to continue the installation process by opening the newer Xcode via Spotlight. Once the additional components installation is finished, you will have the option to uninstall old Xcode installations like 4.2, which you should most definitely make use of!
  4. Afterwards if you make use of the agvtool, and you run into some problems because of cornercases that the installer does not address ... you could have used instructions from http://doronkatz.com/upgrading-to-xcode-43-and-solving-the-develop ... but they seem to have been taken down :(
  5. If you are facing problems with MacPorts, then that may be because:

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.
  1. Create a header & an implementation class containing the sample code
  2. 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.
  3. 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:
  4. This fails as password and transactionKey are distinctly different variables in the header files.
  5. So make sure to substitute the sample code with the username and password used with https://developer.authorize.net/ or https://test.authorize.net/
  6. If you run the code at this point and end up calling loginToGateway, you will run into the following error logs:
  7. 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:
  8. Now you should be at a point where running the code results in the following error logs:
  9. 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
  10. 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:
  11. Even I don't have a solution past this point, feel free to follow this forum thread for any progress on the matter.

AuthNet iOS Integration Part 1

  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.
  2. After you download and unzip the SDK, you can move the files around to have them structured in this manner:
  3. 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/
  4. Goto MyProject > Targets > Build Settings in Xcode and set:
    1. Header Search Paths
      1. "${SDK_DIR}"/usr/include/libxml2
        • Mark the Recursive checkbox as checked
      2. "$(SRCROOT)/anet_ios_sdk-1.0.0/ANMobilePaymentLib"
    2. Library Search Paths
      1. "$(SRCROOT)/anet_ios_sdk-1.0.0/ANMobilePaymentLib"
    3. Other Linker Flags
      1. -lxml2
  5. 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:
  6. Goto MyProject > Targets > Build Phases in Xcode and set:
    1. Link Binary With Libraries
      1. libANMobilePaymentLib.a
  7. For a discussion on the fixes to the sample code, head over to AuthNet iOS Integration Part 2

Wednesday, March 21, 2012

Bamboo Pen Tablet + Mac + InkScape

  • First of all this video made all the difference in the world in terms of getting the bamboo tablet device to do what I wanted it to do once I to understand the pen (absolute) mode versus the mouse mode.

Friday, March 9, 2012

Tweeking Lion OSX for Inkscape

  • In order to use the keyboard and move around the canvas, you will need to disable the default mapping for the 'ctrl' + 'arrow' keys.
  • PageUp and PageDown for bring to front or send to back will be:
    • 'fn' + 'up arrow'
    • 'fn' + 'down arrow'