ios - 如何运行这个使用 cocoa pod 的应用程序?

标签 ios cocoapods

我下载了这个zip https://github.com/Loadex/MessageBanner但不知道如何正确安装它来运行。该应用程序所做的只是显示自定义 iOS 横幅。我希望有 cocoa pod 经验的人能够让这个应用程序在本地运行,并从下载过程中解释他们在一个很好的紧凑答案中做了什么。我想逐步解释如何让它运行。谢谢。到目前为止,我已经尝试过此操作,但在运行时从终端和 Xcode 发出多次警告后删除了项目文件夹。我安装了 cocoa pod 。

WTL2:~ Apple$ cd desktop
WTL2:desktop Apple$ cd m
WTL2:m Apple$ cd MessageBannerDemo
WTL2:MessageBannerDemo Apple$ touch podfile
WTL2:MessageBannerDemo Apple$ pod install
Analyzing dependencies

CocoaPods 0.36.0.beta.2 is available.
To update use: `gem install cocoapods --pre`
[!] This is a test version we'd love you to try.

For more information see http://blog.cocoapods.org
and the CHANGELOG for this version http://git.io/BaH8pQ.

Downloading dependencies
Generating Pods project
Integrating client project

[!] From now on use `MessageBannerDemo.xcworkspace`.

[!] [!] The Podfile does not contain any dependencies.
WTL2:MessageBannerDemo Apple$ 

还将其添加到 podfile

source '<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="dfb8b6ab9fb8b6abb7aabdf1bcb0b2" rel="noreferrer noopener nofollow">[email protected]</a>:CocoaPods/Specs.git'

platform :ios, '7.0'
pod 'MessageBanner', '~> 1.0'

最佳答案

如果您尚未更新 ruby​​ gem 且未安装 cocoa pod,请按照“设置以使用 cocoa pods”,然后按照“运行项目”进行操作。如果你已经安装了cocoapod,那么你可以保留选项“A”。但建议同时遵循“A”和“B”。

A.设置使用 cocoa pod

Open terminal and follow the following steps

  1. update ruby gem

“sudo gem update —system”

Enter you system password when requested. wait it until it finished. it may take little time After successful installation you will see something like this.

Ruby Interactive (ri) documentation was installed. ri is kind of like man 
pages for ruby libraries. You may access it like this:
  ri Classname
  ri Classname.class_method
  ri Classname#instance_method
If you do not wish to install this documentation in the future, use the
--no-document flag, or set it as the default in your ~/.gemrc file. See
'gem help env' for details.

RubyGems system software updated 
  1. Install cocoapods

“sudo gem install cocoapods”

you may get this to override press just enter Y to continue. after successful installation you will see something similar to this

Installing ri documentation for cocoapods-core-0.36.0
Parsing documentation for cocoapods-0.36.0
Installing ri documentation for cocoapods-0.36.0
20 gems installed
  1. to complete the setup of CocoaPods

“pod setup”

after successful, you will see something similar to this.

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin14/rbconfig.rb:213: warning: Insecure world writable dir /usr/local in PATH, mode 040777
    Setting up CocoaPods master repo
    Setup completed

B.运行下载的项目

Open Terminal and follow the these steps

  1. go to the location of your project.

ex cd ~/desktop/myProjects/TestCocoapod

  1. tell cocoapod to install the dependencies for your project.

“pod install”

After successful install, you will see something like this

Generating Pods project
Integrating client project

[!] Please close any current Xcode sessions and use `TestCocoapod.xcworkspace` for this project from now on.

3.Note: after this open the folder containing that project. You must always open the .xcworkspace (ex. TestCocoapod.xcworkspace).

4Now run the project. you can successfully run it.

关于ios - 如何运行这个使用 cocoa pod 的应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28579470/

相关文章:

iphone - 我可以使用 UITextFields 中的用户名和密码信息自动登录到 UIWebView 中的网站吗?

ios - 解析 : How to call a cloud method from an email?

ios - 无法在 Xcode 8.0 beta 6 上启用钥匙串(keychain)共享

ios - 无法找到 CocoaPods 的规范

Xcode 12 更新破坏了 Pod 和产品

android - 如何构建 Firebase 中自动完成搜索的数据

ios - 字符串转字典(二维码字符串取值)

ios - 为什么来自 CocoaPods 的 Acknowledgements.plist 在 iOS 9 上看起来乱七八糟,你能做些什么呢?

CocoaPods:我可以有两个具有不同依赖项和设置的 Pods 项目吗

ios - 如何重建开发 pod 的变化?