【问题标题】:How to get the example of MSCollectionViewCalendarLayout working如何让 MSCollectionViewCalendarLayout 的示例正常工作
【发布时间】:2015-07-29 21:08:03
【问题描述】:

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

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

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

似乎这些库已经过时了。有没有机会让这个项目运行起来?

编辑:

现在我尝试install cocoapods。我在我的主目录(Documents、Desktop、Downloads 所在的位置)中创建了一个 .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解锁并编辑了MASUtilities.h(注释了枚举并添加了static const)。

现在我让项目运行起来了!

【问题讨论】:

  • 当我重新安装 CocoaPods 时,它编译得几乎没有问题,除了 Masonry 的已知问题:github.com/SnapKit/Masonry/issues/82
  • 感谢您的评论。现在我尝试安装 CocoaPods,但它仍然不起作用(请参阅我编辑的问题)。你知道怎么回事吗?
  • 安装CocoaPods实用程序后,需要在Example目录下运行pod install,然后从.xcworkspace打开。
  • 非常感谢。现在它起作用了!您可以发布您的 cmets 作为答案吗?那我就可以接受了。

标签: ios calendar cocoapods


【解决方案1】:

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

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

仍然会有由已知issue 与 Masonry 引起的编译错误 - 如链接问题所述,解决方法是将有问题的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;

【讨论】:

  • 也许你可以再帮忙。现在我又试了一次,我得到了ndefined symbols for architecture i386: "_RKLogCoreDataError", referenced from: ___33-[RKEntityByAttributeCache load:]_block_invoke in libRestKit.a(RKEntityByAttributeCache.o) ___43-[RKManagedObjectImporter finishImporting:]_block_invoke in libRestKit.a(RKManagedObjectImporter.o) ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)。只找到this thread,但没有帮助。
  • 请考虑用新问题打开另一个问题 - 这样问题就不会混淆,您也可能会从其他人那里得到解决方案..
  • 是的,先生! Here你是。
猜你喜欢
  • 1970-01-01
  • 2014-05-13
  • 2016-03-04
  • 2015-03-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多