RubyMotion和CocoaPods的问题

问题描述 投票:4回答:2

我在使用CocoaPods依赖项在RubyMotion中工作时遇到了各种各样的问题。首先,如果我将dependency 'JSONKit'添加到我的Rakefile然后运行rake它会因can't convert Pathname into String错误而中止。然后rake --trace产生以下输出:

** Invoke default (first_time)
** Invoke simulator (first_time)
** Invoke build:simulator (first_time)
** Execute build:simulator
/usr/bin/gen_bridge_metadata --format complete --no-64-bit --cflags "-I. -I." JSONKit.h -o "JSONKit.bridgesupport"
invalid option: --no-64-bit
Usage: gen_bridge_metadata [options] <headers...>
Use the `-h' flag or consult gen_bridge_metadata(1) for help.
rake aborted!
Command failed with status (1): [/usr/bin/gen_bridge_metadata --format comp...]
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/file_utils.rb:53:in `block in create_shell_runner'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/file_utils.rb:45:in `call'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/file_utils.rb:45:in `sh'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/file_utils_ext.rb:39:in `sh'
/Library/RubyMotion/lib/motion/project/vendor.rb:93:in `block in build_static'
/Library/RubyMotion/lib/motion/project/vendor.rb:34:in `chdir'
/Library/RubyMotion/lib/motion/project/vendor.rb:34:in `build_static'
/Library/RubyMotion/lib/motion/project/vendor.rb:23:in `build'
/Library/RubyMotion/lib/motion/project/builder.rb:37:in `block in build'
/Library/RubyMotion/lib/motion/project/builder.rb:36:in `each'
/Library/RubyMotion/lib/motion/project/builder.rb:36:in `build'
/Library/RubyMotion/lib/motion/project/app.rb:50:in `build'
/Library/RubyMotion/lib/motion/project.rb:33:in `block (2 levels) in <top (required)>'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/task.rb:205:in `call'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/task.rb:205:in `block in execute'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/task.rb:200:in `each'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/task.rb:200:in `execute'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/task.rb:151:in `invoke_with_call_chain'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/task.rb:176:in `block in invoke_prerequisites'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/task.rb:174:in `each'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/task.rb:174:in `invoke_prerequisites'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/task.rb:157:in `block in invoke_with_call_chain'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/task.rb:151:in `invoke_with_call_chain'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/task.rb:176:in `block in invoke_prerequisites'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/task.rb:174:in `each'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/task.rb:174:in `invoke_prerequisites'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/task.rb:157:in `block in invoke_with_call_chain'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/task.rb:151:in `invoke_with_call_chain'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/task.rb:144:in `invoke'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/application.rb:116:in `invoke_task'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/application.rb:94:in `block (2 levels) in top_level'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/application.rb:94:in `each'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/application.rb:94:in `block in top_level'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/application.rb:88:in `top_level'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/application.rb:66:in `block in run'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling'
/Users/xxxx/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/application.rb:63:in `run'
/Users/xxxx/.rbenv/versions/1.9.3-p194/bin/rake:32:in `<main>'
Tasks: TOP => default => simulator => build:simulator

项目中的供应商目录包含各种JSONKit文件。

其次,在另一个RubyMotion应用程序中,如果我将dependency 'Nimbus'添加到我的Rakefile然后运行rake应用程序构建但是当我尝试在我的代码中使用任何与Nimbus相关的内容并且没有创建供应商目录时,会出现未初始化的常量错误。

这两个例子有什么问题?

cocoapods rubymotion
2个回答
4
投票

这里有几个问题在起作用。

无法将Pathname转换为String

更新:截至2012年5月7日,你可以只是sudo motion update,这将是固定的

此错误与您使用Ruby 1.9的事实有关。虽然我没有在文档中明确说明,但设置这个的例子是指在sudo命令中使用gem install这一事实意味着它假设你正在运行OS X的内置ruby(1.8.7)。如果将项目切换到系统ruby(在其中添加带.rbenv-versionsystem文件)。或者,如果你想坚持使用1.9,你可以将/Library/RubyMotion/lib/motion/project/vendor.rb的第22行改为:

App.info 'Build', @path.to_s

一旦这样做,你很有可能会得到这样的错误:

ERROR! Building vendor project `./vendor/JSONKit' failed to create at least one `.a' library.`

您需要编辑同一文件的第77行来阅读:

objs = Dir.glob('**/*.o') # Removed the leading "*/"

然后rake应该最终正常工作。

有关这些问题的motion-cocoapods回购提出了一个问题:https://github.com/HipByte/motion-cocoapods/issues/1

此外,我刚刚使用motion support为此提交了官方支持票。 (请记住,您为这个包含支持的全新产品付了钱;使用它!)

雨云

这里的问题是你需要顶级的cocoapod。由于它有“subspecs”,你需要直接要求,所以也许dependency 'Nimbus/Core'。你可以看到它们的完整列表here(参见s.subspec条目)


1
投票

关于--no-64-bit标志的编译错误是因为Snow Leopard上的RubyMotion。每个https://gist.github.com/2597428更新/Library/RubyMotion/lib/motion/project/vendor.rb

该错误已得到Laurent Sansonetti的证实:

嗨,

谢谢你的报道!问题是在Lion中添加了--no-64位标志,你似乎正在运行Snow Leopard。我们将解决这个问题。

洛朗

© www.soinside.com 2019 - 2024. All rights reserved.