我试图在我的Rubymotion项目中使用SVGKit,但似乎无法构建它。
到目前为止,我已经将SVGKit代码移到了vendor / SVGKit中,并将以下内容添加到我的Rakefile中(否则,这是一个空白项目)
# -*- coding: utf-8 -*-
$:.unshift("/Library/RubyMotion/lib")
require 'motion/project/template/ios'
begin
require 'bundler'
Bundler.require
rescue LoadError
end
Motion::Project::App.setup do |app|
app.name = 'SVGKitMotion'
app.frameworks += %w[ CoreText CoreImage libxml2.dylib QuartzCore CoreGraphics UIKit ]
app.vendor_project('vendor/SVGKit', :static,
:products => ["libSVGKit-iOS.1.2.0pre.a"])
end
当我尝试构建它时,我得到以下信息:
Build ./build/iPhoneSimulator-7.0-Development
Build vendor/SVGKit
Compile vendor/SVGKit/Source/DOM classes/Core DOM/AppleSucksDOMImplementation.m
Compile vendor/SVGKit/Source/DOM classes/Core DOM/Attr.m
Compile vendor/SVGKit/Source/DOM classes/Core DOM/CDATASection.m
Compile vendor/SVGKit/Source/DOM classes/Core DOM/CharacterData.m
Compile vendor/SVGKit/Source/DOM classes/Core DOM/Comment.m
Compile vendor/SVGKit/Source/DOM classes/Core DOM/CSSPrimitiveValue.m
Compile vendor/SVGKit/Source/DOM classes/Core DOM/CSSRule.m
Compile vendor/SVGKit/Source/DOM classes/Core DOM/CSSRuleList.m
Compile vendor/SVGKit/Source/DOM classes/Core DOM/CSSStyleDeclaration.m
Compile vendor/SVGKit/Source/DOM classes/Core DOM/CSSStyleRule.m
Compile vendor/SVGKit/Source/DOM classes/Core DOM/CSSStyleSheet.m
Compile vendor/SVGKit/Source/DOM classes/Core DOM/CSSValue.m
Compile vendor/SVGKit/Source/DOM classes/Core DOM/CSSValueList.m
Source/DOM classes/Core DOM/CSSValueList.m:47:2: warning: implicit declaration of function 'DDLogVerbose' is invalid in C99 [-Wimplicit-function-declaration]
DDLogVerbose(@"[%@] received new CSS Text, need to split this and save as CSSValue instances: %@", [self class], _cssText);
^
1 warning generated.
Compile vendor/SVGKit/Source/DOM classes/Core DOM/Document.m
Source/DOM classes/Core DOM/Document.m:26:2: warning: implicit declaration of function 'DDLogVerbose' is invalid in C99 [-Wimplicit-function-declaration]
DDLogVerbose( @"[%@] WARNING: SVG Spec, missing feature: if there are known attributes with default values, Attr nodes representing them SHOUL...
^
1 warning generated.
Compile vendor/SVGKit/Source/DOM classes/Core DOM/DocumentFragment.m
Compile vendor/SVGKit/Source/DOM classes/Core DOM/DocumentType.m
Compile vendor/SVGKit/Source/DOM classes/Core DOM/DOMHelperUtilities.m
Compile vendor/SVGKit/Source/DOM classes/Core DOM/Element.m
Compile vendor/SVGKit/Source/DOM classes/Core DOM/EntityReference.m
Compile vendor/SVGKit/Source/DOM classes/Core DOM/MediaList.m
Compile vendor/SVGKit/Source/DOM classes/Core DOM/NamedNodeMap.m
Compile vendor/SVGKit/Source/DOM classes/Core DOM/Node.m
Compile vendor/SVGKit/Source/DOM classes/Core DOM/NodeList.m
Compile vendor/SVGKit/Source/DOM classes/Core DOM/ProcessingInstruction.m
Compile vendor/SVGKit/Source/DOM classes/Core DOM/StyleSheet.m
Compile vendor/SVGKit/Source/DOM classes/Core DOM/StyleSheetList.m
Compile vendor/SVGKit/Source/DOM classes/Core DOM/Text.m
Compile vendor/SVGKit/Source/DOM classes/SVG-DOM/SVGAngle.m
Compile vendor/SVGKit/Source/DOM classes/SVG-DOM/SVGAnimatedPreserveAspectRatio.m
Compile vendor/SVGKit/Source/DOM classes/SVG-DOM/SVGDefsElement.m
In file included from Source/DOM classes/SVG-DOM/SVGDefsElement.m:1:
Source/DOM classes/SVG-DOM/SVGDefsElement.h:5:9: fatal error: 'SVGElement.h' file not found
#import "SVGElement.h"
^
1 error generated.
rake aborted!
Command failed with status (1): [/Applications/Xcode.app/Contents/Developer...]
/Library/RubyMotion/lib/motion/project/vendor.rb:114:in `block (2 levels) in build_static'
/Library/RubyMotion/lib/motion/project/vendor.rb:72:in `each'
/Library/RubyMotion/lib/motion/project/vendor.rb:72:in `block in build_static'
/Library/RubyMotion/lib/motion/project/vendor.rb:65:in `chdir'
/Library/RubyMotion/lib/motion/project/vendor.rb:65:in `build_static'
/Library/RubyMotion/lib/motion/project/vendor.rb:42:in `build'
/Library/RubyMotion/lib/motion/project/builder.rb:65:in `block in build'
/Library/RubyMotion/lib/motion/project/builder.rb:64:in `each'
/Library/RubyMotion/lib/motion/project/builder.rb:64:in `build'
/Library/RubyMotion/lib/motion/project/app.rb:76:in `build'
/Library/RubyMotion/lib/motion/project/template/ios.rb:46:in `block (2 levels) in <top (required)>'
/Library/RubyMotion/lib/motion/project/template/ios.rb:63:in `block in <top (required)>'
Tasks: TOP => build:simulator
(See full trace by running task with --trace)
有人可以提供关于我哪里出问题的建议吗?
最佳答案
DDLogVerbose是CocoaLumberjack中的函数。最好的选择就是通过CocoaPods安装SVGKit。为此,请先安装运动cocoapods
sudo gem install motion-cocoapods
这应该安装cocoapods和motion-cocoapods。您需要设置cocoapods,然后运行
pod setup
现在您可以将运动cocoapods添加到您的Gemfile中
gem 'motion-cocoapods'
接下来将Pod添加到您的rake文件中
app.pods do
pod 'SVGKit'
end
最后运行以下rake命令下载SVGKit
rake pod:install
下次您耙耙时,理论上所有内容都应该可以编译并正常工作!祝好运 :)