I was playing around with RubyMotion and the Objective-C iHasApp library. Given that it’s just three files that are needed (a
.h, and a JSON data file) I’d figured I’d have it working in no time. I was wrong.
My first attempt involved me copying the three files to a
vendor/iHasApp directory inside my app. Then, in my Rakefile I added the line:
Well, that was easy! Let’s run the app. Whoops!
Everything looked fine in my app as I had a properly generated
.bridgesupport file. Hmmm, what was it?
I figured that my problem could have been due to there not being an
.a file (SPOILER ALERT: it wasn’t :)).
Searching and Searching
So off to Google I went, searching and searching. I couldn’t figure out what was wrong. Pretty frustrating. In the end I wasn’t searching for the right thing. Thankfully I stumbled upon an answer by Laurent Sansonetti on the RubyMotion Google Group. DUH! “The problem is that the iSpeechSDK class name starts with a lower-case letter, which is not a valid constant name in Ruby.” This same thing applies to iHasApp, doesn’t it? The fix is simple, just use
IHasApp.alloc.init instead of
iHasApp.alloc.init. Super easy fix (and obvious), but finding the answer was quite a challenge.