7

RubyMotion provides these instructions for vendoring 3rd party code: http://www.rubymotion.com/developer-center/guides/project-management/#_files_dependencies

I'm trying to add Parse.com's iOS SDK. These are the instructions for adding it to an XCode project: https://parse.com/apps/quickstart#ios/existing. However, I'm not using XCode since I'm working with RubyMotion.

I documented my attempt here: https://github.com/adelevie/RubyMotionSamples/commit/603bf4428995bb203cce7e7e8e6989d6e86bda3b

And here are the errors I'm getting: https://gist.github.com/2595284

user94154
  • 16,176
  • 20
  • 77
  • 116

3 Answers3

8

I believe we're actually dealing with a static library here, so I believe you should specify :static instead of :Xcode as the second option.

With the following code in your Rakefile, the app compiles:

    app.libs << '/usr/lib/libz.1.1.3.dylib'
    app.frameworks += [
        'AudioToolbox',
        'CFNetwork',
        'SystemConfiguration',
        'MobileCoreServices',
        'Security',
        'QuartzCore']

    app.vendor_project('vendor/Parse.framework', :static,
        :products => ['Parse'],
        :headers_dir => 'Heiders')

However, I'm getting the following error running the Parse setApplicationId method:

(main)>> Objective-C stub for message `setApplicationId:clientKey:' type `v@:@@' not precompiled. Make sure you properly link with the framework or library that defines this message.
richard
  • 14,050
  • 8
  • 37
  • 39
  • I never got it. Did you look at the gist I posted? – user94154 May 04 '12 at 20:00
  • 1
    Yes I did. That's the only content of your application method inside AppDelegate? – richard May 04 '12 at 20:05
  • That gist was run in the REPL and worked fine. I got this working in app_delegate.rb though: https://gist.github.com/2597444 For some reason, calling #save throws `Objective-C stub for message `save' type `c@:' not precompiled. Make sure you properly link with the framework or library that defines this message.` So the solution is to call #saveEventually which works fine. I'm brand new to iOS so I could have the wrong idea. – user94154 May 04 '12 at 20:17
  • I think I've figured it out: If I just setApplicationId, but don't call any metods later in the app, I get that error. If I create a dummy PFObject, without needing to save it, I avoid the error. Weird, but it works. – user94154 May 05 '12 at 23:10
  • I'm getting the same error. Not sure if I understand @user94154 solution. The only way I could call the method was by not calling it until my application is done loading. – igorgue May 07 '12 at 08:57
  • Still haven't fixed this. Quering for objects works fine, but Facebook login generates the same error. – richard May 07 '12 at 09:57
  • I had the same issue when building a project with aqtoolkit. Eventually I modified the method signature to remove the use of any primitive types and the problem is gone. – yuxhuang May 07 '12 at 13:21
  • Perhaps start a new SO question for this? – user94154 May 10 '12 at 00:37
  • 1
    This does not work for me. Get the following error when running rake: Undefined symbols for architecture i386: "_OBJC_CLASS_$_SKPaymentQueue", referenced from: objc-class-ref in Parse(PFPurchase.o) objc-class-ref in Parse(PFPaymentTransactionObserver.o) "_OBJC_CLASS_$_SKPayment", referenced from: objc-class-ref in Parse(PFPurchase.o) "_OBJC_CLASS_$_SKProductsRequest", referenced from: objc-class-ref in Parse(PFPurchase.o) ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation) – Flaviu Jul 28 '12 at 20:50
2

The documentation linked says, "To vendor a 3rd-party library in a RubyMotion project, the source code must be available somewhere on the filesystem." So I don't think dropping a .framework file in there will work.

You could try downloading the ParseStartProject, called "Blank Xcode w/ SDK" from parse.com/docs. If you vendor that project folder, RubyMotion will be able to find an xcode project like it's looking for. You'll want to delete the .m and .h files from the xcode project, of course, since you only want the project to include Parse.framework.

I haven't actually tried this. Please let us know if you get it working.

bklimt
  • 1,822
  • 15
  • 11
  • Having trouble with this: https://skitch.com/e-adelevie/8a9mg/users-adelevie-programming-motion-rubymotionsamples-tweets-bash-114x24 The error is `Building vendor project `vendor/ParseStarterProject' failed to create at least one `.a' library.` – user94154 May 04 '12 at 17:03
1

Okay copied this from an answer in the RubyMotion group. It seems to fix the stub error message:

Now, to make this work, I've modified /Library/RubyMotion/lib/motion/project/vendor.rb and changed the Dir.glob on line 38 from:

source_files = (opts.delete(:source_files) or Dir.glob('*. 
{c,m,cpp,cxx,mm,h}')) 

to:

source_files = (opts.delete(:source_files) or Dir.glob('**/*. 
{c,m,cpp,cxx,mm,h}'))

http://groups.google.com/group/rubymotion/msg/0efa74214523d0f5

Sander Hahn
  • 256
  • 1
  • 3