菜鸟教程小白 发表于 2022-12-13 10:17:50

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


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

<pre><code>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&#39;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$
</code></pre>

<p>也将此添加到 podfile</p>

<pre><code>source &#39;[email protected]:CocoaPods/Specs.git&#39;

platform :ios, &#39;7.0&#39;
pod &#39;MessageBanner&#39;, &#39;~&gt; 1.0&#39;
</code></pre></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>如果你还没有更新 ruby​​ gem 并且没有安装 cocoa pod,那么按照“setup to use cocoa pods”和之后的“To run the project”。如果您已经安装了 cocoapod,那么您可以离开选项“A”。但建议同时遵循“A”和“B”。</p>

<p><strong>A.设置使用 cocoapod </strong></p>

<blockquote>
<p>Open terminal and follow the following steps</p>

<ol>
<li>update ruby gem </li>
</ol>

<p><code>“sudo gem update —system”</code></p>

<p>Enter you system password when requested. wait it until it finished.
it may take little time
Aftersuccessful installation you will see something like this.</p>
</blockquote>

<pre><code>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
&#39;gem help env&#39; for details.

RubyGems system software updated
</code></pre>

<blockquote>
<ol start="2">
<li>Install cocoapods</li>
</ol>

<p><code>“sudo gem install cocoapods”</code></p>

<p>you may get this to override press just enter Y to continue.
after successful installation you will see something similar to this</p>
</blockquote>

<pre><code>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
</code></pre>

<blockquote>
<ol start="3">
<li>to complete the setup of CocoaPods </li>
</ol>

<p><code>“pod setup”</code></p>

<p>after successful, you will see something similar to this.</p>
</blockquote>

<pre><code>/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
</code></pre>

<p><strong>B.运行下载的项目</strong></p>

<blockquote>
<p>Open Terminal and follow the these steps</p>

<ol>
<li>go to the location of your project.</li>
</ol>

<p><code>ex cd ~/desktop/myProjects/TestCocoapod</code></p>

<ol start="2">
<li>tell cocoapod to install the dependencies for your project.</li>
</ol>

<p><code>“pod install”</code></p>

<p>After successful install, you will see something like this</p>
</blockquote>

<pre><code>Generating Pods project
Integrating client project

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

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

<p>4Now run the project. you can successfully run it.</p>
</blockquote></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 如何运行这个使用 cocoapod 的应用程序?,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/28579470/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/28579470/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 如何运行这个使用 cocoa pod 的应用程序?