如何获得MSCollectionViewCalendarLayout工作的示例

时间:2015-05-18 11:23:26

标签: ios calendar cocoapods

我下载了MSCollectionViewCalendarLayout,现在我想尝试一下这个例子。如果我打开 Example.xcodeproj ,我只会遇到错误,例如

  

词法或预处理器问题' RestKit / RestKit.h'找不到文件

我尝试了troubleshooting guide的提示来更改项目设置,但它没有奏效。如果我打开 Example.xcworkspace ,我也只会收到错误。

似乎图书馆已经过时了。有没有机会让这个项目运行?

修改

现在我尝试install cocoapods。我在我的主目录中创建了一个 .profile 文件(文档,桌面,下载所在的文件)。我将此文本放入文件

export GEM_HOME=$HOME/.gem
export PATH=$GEM_HOME/bin:$PATH

然后我跑

gem install cocoapods --user-install

因为他没有做某事(在终端的下一行),我按了 q 。然后他做了一些事情,我得到了以下警告

  

警告:您没有/Users/my-user/.gem/ruby/2.0.0/bin   PATH,gem可执行文件将无法运行。

终端的完整输出

Fetching: i18n-0.7.0.gem (100%)
WARNING:  You don't have /Users/my-user/.gem/ruby/2.0.0/bin in your PATH,
      gem executables will not run.
qSuccessfully installed i18n-0.7.0
Fetching: thread_safe-0.3.5.gem (100%)
Successfully installed thread_safe-0.3.5
Fetching: tzinfo-1.2.2.gem (100%)
Successfully installed tzinfo-1.2.2
Fetching: minitest-5.6.1.gem (100%)
Successfully installed minitest-5.6.1
Fetching: activesupport-4.2.1.gem (100%)
Successfully installed activesupport-4.2.1
Fetching: nap-0.8.0.gem (100%)
Successfully installed nap-0.8.0
Fetching: fuzzy_match-2.0.4.gem (100%)
Successfully installed fuzzy_match-2.0.4
Fetching: cocoapods-core-0.37.1.gem (100%)
Successfully installed cocoapods-core-0.37.1
Fetching: claide-0.8.1.gem (100%)
Successfully installed claide-0.8.1
Fetching: colored-1.2.gem (100%)
Successfully installed colored-1.2
Fetching: xcodeproj-0.24.1.gem (100%)
Successfully installed xcodeproj-0.24.1
Fetching: cocoapods-downloader-0.9.0.gem (100%)
Successfully installed cocoapods-downloader-0.9.0
Fetching: cocoapods-plugins-0.4.2.gem (100%)
Successfully installed cocoapods-plugins-0.4.2
Fetching: cocoapods-try-0.4.4.gem (100%)
Successfully installed cocoapods-try-0.4.4
Fetching: netrc-0.7.8.gem (100%)
Successfully installed netrc-0.7.8
Fetching: cocoapods-trunk-0.6.0.gem (100%)
Successfully installed cocoapods-trunk-0.6.0
Fetching: molinillo-0.2.3.gem (100%)
Successfully installed molinillo-0.2.3
Fetching: escape-0.0.4.gem (100%)
Successfully installed escape-0.0.4
Fetching: cocoapods-0.37.1.gem (100%)
Successfully installed cocoapods-0.37.1
Parsing documentation for i18n-0.7.0
Installing ri documentation for i18n-0.7.0
Parsing documentation for thread_safe-0.3.5
Installing ri documentation for thread_safe-0.3.5
Parsing documentation for tzinfo-1.2.2
Installing ri documentation for tzinfo-1.2.2
Parsing documentation for minitest-5.6.1
Installing ri documentation for minitest-5.6.1
Parsing documentation for activesupport-4.2.1
unable to convert "\x84" from ASCII-8BIT to UTF-8 for lib/active_support/values/unicode_tables.dat, skipping
Installing ri documentation for activesupport-4.2.1
Parsing documentation for nap-0.8.0
Installing ri documentation for nap-0.8.0
Parsing documentation for fuzzy_match-2.0.4
Installing ri documentation for fuzzy_match-2.0.4
Parsing documentation for cocoapods-core-0.37.1
Installing ri documentation for cocoapods-core-0.37.1
Parsing documentation for claide-0.8.1
Installing ri documentation for claide-0.8.1
Parsing documentation for colored-1.2
Installing ri documentation for colored-1.2
Parsing documentation for xcodeproj-0.24.1
Installing ri documentation for xcodeproj-0.24.1
Parsing documentation for cocoapods-downloader-0.9.0
Installing ri documentation for cocoapods-downloader-0.9.0
Parsing documentation for cocoapods-plugins-0.4.2
Installing ri documentation for cocoapods-plugins-0.4.2
Parsing documentation for cocoapods-try-0.4.4
Installing ri documentation for cocoapods-try-0.4.4
Parsing documentation for netrc-0.7.8
Installing ri documentation for netrc-0.7.8
Parsing documentation for cocoapods-trunk-0.6.0
Installing ri documentation for cocoapods-trunk-0.6.0
Parsing documentation for molinillo-0.2.3
Installing ri documentation for molinillo-0.2.3
Parsing documentation for escape-0.0.4
Installing ri documentation for escape-0.0.4
Parsing documentation for cocoapods-0.37.1
Installing ri documentation for cocoapods-0.37.1
19 gems installed

然后我重新打开了Xcode示例,但我仍然遇到 RestKit.h 无法找到的错误。我做错了什么?

编辑2:

现在我尝试在示例目录中使用pod install,但pod command was not found。因此,我将 .profile 中的PATH编辑为此

export PATH=$GEM_HOME/ruby/2.0.0/bin:$PATH

然后我重新启动终端并再次运行命令

Analyzing dependencies
Creating shallow clone of spec repo `master` from `https://github.com/CocoaPods/Specs.git`

Fetching podspec for `MSCollectionViewCalendarLayout` from `../`
Downloading dependencies
Installing AFNetworking 1.3.3 (was 1.3.3)
Installing CupertinoYankee 0.1.1 (was 0.1.1)
Installing ISO8601DateFormatterValueTransformer (0.5.0)
Using MSCollectionViewCalendarLayout (0.1.3)
Installing Masonry 0.4.0 (was 0.4.0)
Installing RKValueTransformers (1.0.1)
Installing RestKit 0.22.0 (was 0.22.0)
Installing SOCKit 1.1 (was 1.1)
Installing TransitionKit 2.0.0 (was 2.0.0)
Installing UIColor-HexString (1.0.1)
Generating Pods project
Integrating client project

之后我打开 Example.xcworkspace 并得到Jakub Vano描述的错误。然后我根据this link(评论枚举并添加了静态const )解锁并编辑了MASUtilities.h

现在我让项目运行了!

1 个答案:

答案 0 :(得分:3)

您需要为示例项目重新安装CocoaPods:

  • 在示例项目目录中运行pod install
  • .xcworkspace
  • 运行项目

仍然存在由已知issue与砌体造成的编译错误 - 如链接问题所述,解决方法是用

替换有问题的enum
typedef float MASLayoutPriority;
static const MASLayoutPriority MASLayoutPriorityRequired = UILayoutPriorityRequired;
static const MASLayoutPriority MASLayoutPriorityDefaultHigh = UILayoutPriorityDefaultHigh;
static const MASLayoutPriority MASLayoutPriorityDefaultMedium = 500;
static const MASLayoutPriority MASLayoutPriorityDefaultLow = UILayoutPriorityDefaultLow;
static const MASLayoutPriority MASLayoutPriorityFittingSizeLevel = UILayoutPriorityFittingSizeLevel;