Masonry 框架从官方 GitHub 下载的 example 怎么运行

问答Utopia • 于 2015-11-10 02:43:58 +0800 • 最后由 Utopia2015-11-11 00:36:58 +0800 16898 阅读

下载的链接:https://github.com/SnapKit/Masonry.git 下载后的文件

file

打开Masonry.xcworkspace

file

编译成功但是没有运行

如果单独打开Examples文件夹下的Masonry iOS Examples.xcodeproj编译发生错误

file

回复: 19
  • dugege 2015-11-10 04:54:23 +0800

    然后你找到原因了么?

  • Utopia 2015-11-10 07:01:28 +0800

    @dugege 没有啊,我想学习 Masonry 框架网上的教程又不全面,想要下载官方的 example 学习,但是又不回运行。。。可能是 CocoaPods 的问题

  • dugege 2015-11-10 07:44:19 +0800

    嗯,就是pod的问题,因为configurations的配置文件里面要加载

  • Utopia 2015-11-10 08:15:23 +0800

    @dugege configurations的配置文件怎么加载呢

  • Utopia 2015-11-10 08:17:03 +0800

    @dugege 还有怎么把 CocoaPods 的 installer.project 改变成 installer.pods_project呢

  • dugege 2015-11-10 08:17:07 +0800

    file

  • dugege 2015-11-10 08:18:40 +0800
  • Utopia 2015-11-10 08:21:53 +0800

    @dugege 我看了下已经加载了

    file

  • dugege 2015-11-10 08:29:25 +0800

    @Utopia 我的意思是就因为有他所以报错··

  • iBcker 2015-11-10 08:31:04 +0800

    you need cocoapods

  • Utopia 2015-11-10 08:39:14 +0800

    @iBcker 我有安装cocoapods

  • Utopia 2015-11-10 08:41:02 +0800

    @dugege 我把它们都设置成none,还是不行额

  • dugege 2015-11-10 08:43:38 +0800

    @Utopia ····当然不行····你先恶补一下pod怎么用先吧···

  • Utopia 2015-11-10 08:46:55 +0800

    @iBcker 我运行pod install 的时候报错了,Google下,好像是要把CocoaPods 的 installer.project 改变成 installer.pods_project,但是不知道怎么配置。下面是报错的信息:

    Utopia:Masonry utopia$ pod install
    Updating local specs repositories
    Analyzing dependencies
    Fetching podspec for `Masonry` from `./`
    Downloading dependencies
    Using Expecta (1.0.0)
    Installing Masonry 0.6.3 (was 0.6.1)
    Generating Pods project
    [!] An error occurred while processing the post-install hook of the Podfile.
    
    undefined method `project' for #<Pod::Installer:0x007f876a1cc048>
    
    /Users/utopia/Documents/iOS/Test/Masonry/Podfile:28:in `block (2 levels) in from_ruby'
    /usr/local/lib/ruby/gems/2.2.0/gems/cocoapods-core-0.39.0/lib/cocoapods-core/podfile.rb:170:in `call'
    /usr/local/lib/ruby/gems/2.2.0/gems/cocoapods-core-0.39.0/lib/cocoapods-core/podfile.rb:170:in `post_install!'
    /usr/local/lib/ruby/gems/2.2.0/gems/cocoapods-0.39.0/lib/cocoapods/installer.rb:806:in `run_podfile_post_install_hook'
    /usr/local/lib/ruby/gems/2.2.0/gems/cocoapods-0.39.0/lib/cocoapods/installer.rb:794:in `block in         /run_podfile_post_install_hooks'
    /usr/local/lib/ruby/gems/2.2.0/gems/cocoapods-0.39.0/lib/cocoapods/user_interface.rb:140:in `message'
    /usr/local/lib/ruby/gems/2.2.0/gems/cocoapods-0.39.0/lib/cocoapods/installer.rb:793:in `run_podfile_post_install_hooks'
    /usr/local/lib/ruby/gems/2.2.0/gems/cocoapods-0.39.0/lib/cocoapods/installer.rb:158:in `block in generate_pods_project'
    /usr/local/lib/ruby/gems/2.2.0/gems/cocoapods-0.39.0/lib/cocoapods/user_interface.rb:59:in `section'
    /usr/local/lib/ruby/gems/2.2.0/gems/cocoapods-0.39.0/lib/cocoapods/installer.rb:153:in `generate_pods_project'
    /usr/local/lib/ruby/gems/2.2.0/gems/cocoapods-0.39.0/lib/cocoapods/installer.rb:111:in `install!'
    /usr/local/lib/ruby/gems/2.2.0/gems/cocoapods-0.39.0/lib/cocoapods/command/project.rb:71:in `run_install_with_update'
    /usr/local/lib/ruby/gems/2.2.0/gems/cocoapods-0.39.0/lib/cocoapods/command/project.rb:101:in `run'
    /usr/local/lib/ruby/gems/2.2.0/gems/claide-0.9.1/lib/claide/command.rb:312:in `run'
    /usr/local/lib/ruby/gems/2.2.0/gems/cocoapods-0.39.0/lib/cocoapods/command.rb:47:in `run'
    /usr/local/lib/ruby/gems/2.2.0/gems/cocoapods-0.39.0/bin/pod:44:in `<top (required)>'
    /usr/local/bin/pod:23:in `load'
    /usr/local/bin/pod:23:in `<main>'
    
  • Utopia 2015-11-10 08:51:12 +0800

    @dugege 哦哦,我 pod install的时候报错了,Google下,好像是要把CocoaPods 的 installer.project 改变成 installer.pods_project,但是不知道怎么配置。下面是报错的信息:

    Utopia:Masonry utopia$ pod install
    Updating local specs repositories
    Analyzing dependencies
    Fetching podspec for `Masonry` from `./`
    Downloading dependencies
    Using Expecta (1.0.0)
    Installing Masonry 0.6.3 (was 0.6.1)
    Generating Pods project
    [!] An error occurred while processing the post-install hook of the Podfile.
    
    undefined method `project' for #<Pod::Installer:0x007f876a1cc048>
    
    /Users/utopia/Documents/iOS/Test/Masonry/Podfile:28:in `block (2 levels) in from_ruby'
    /usr/local/lib/ruby/gems/2.2.0/gems/cocoapods-core-0.39.0/lib/cocoapods-core/podfile.rb:170:in `call'
    /usr/local/lib/ruby/gems/2.2.0/gems/cocoapods-core-0.39.0/lib/cocoapods-core/podfile.rb:170:in `post_install!'
    /usr/local/lib/ruby/gems/2.2.0/gems/cocoapods-0.39.0/lib/cocoapods/installer.rb:806:in `run_podfile_post_install_hook'
    /usr/local/lib/ruby/gems/2.2.0/gems/cocoapods-0.39.0/lib/cocoapods/installer.rb:794:in `block in             /run_podfile_post_install_hooks'
    /usr/local/lib/ruby/gems/2.2.0/gems/cocoapods-0.39.0/lib/cocoapods/user_interface.rb:140:in `message'
    /usr/local/lib/ruby/gems/2.2.0/gems/cocoapods-0.39.0/lib/cocoapods/installer.rb:793:in `run_podfile_post_install_hooks'
    /usr/local/lib/ruby/gems/2.2.0/gems/cocoapods-0.39.0/lib/cocoapods/installer.rb:158:in `block in generate_pods_project'
    /usr/local/lib/ruby/gems/2.2.0/gems/cocoapods-0.39.0/lib/cocoapods/user_interface.rb:59:in `section'
    /usr/local/lib/ruby/gems/2.2.0/gems/cocoapods-0.39.0/lib/cocoapods/installer.rb:153:in `generate_pods_project'
    /usr/local/lib/ruby/gems/2.2.0/gems/cocoapods-0.39.0/lib/cocoapods/installer.rb:111:in `install!'
    /usr/local/lib/ruby/gems/2.2.0/gems/cocoapods-0.39.0/lib/cocoapods/command/project.rb:71:in `run_install_with_update'
    /usr/local/lib/ruby/gems/2.2.0/gems/cocoapods-0.39.0/lib/cocoapods/command/project.rb:101:in `run'
    /usr/local/lib/ruby/gems/2.2.0/gems/claide-0.9.1/lib/claide/command.rb:312:in `run'
    /usr/local/lib/ruby/gems/2.2.0/gems/cocoapods-0.39.0/lib/cocoapods/command.rb:47:in `run'
    /usr/local/lib/ruby/gems/2.2.0/gems/cocoapods-0.39.0/bin/pod:44:in `<top (required)>'
    /usr/local/bin/pod:23:in `load'
    /usr/local/bin/pod:23:in `<main>' 
    
  • iBcker 2015-11-10 09:01:16 +0800

    @Utopia Podfile 找这个文件,打开

  • Utopia 2015-11-10 11:16:37 +0800

    @iBcker 谢谢,我运行pod install 已经成功了,但是Xcode里同时有好几个project,我不知道怎么运行其中的 example project,所有的文件都编译成功就是没有弹出模拟器,单独进入Example文件下运行又编译错误,里面都没有xcworkspace类型的文件,我在 Example 文件夹下再创建一个 podfile 文件,写入 pod 'Masonry',但是pod install时候又错误了,好像是重复建立了。

  • iBcker 2015-11-10 11:22:17 +0800

    @Utopia 运行按钮的右边→_→

  • Utopia 2015-11-11 00:36:58 +0800

    @iBcker 谢谢,都没遇到过好几个工程的情况。。

  • 请注意单词拼写,以及中英文排版,参考此页
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`, 更多语法请见这里 Markdown 语法
  • 支持表情,见 Emoji cheat sheet
  • @name 会链接到用户页面,并会通知他
  • 上传图片, 支持拖拽和剪切板黏贴上传, 格式限制 - jpg, png, gif
Ctrl+Enter