ios - 将 CocoaPods 与 2 个项目一起使用时的运行时输出 objc[69590]
<p><p>我创建了 2 个 xcode 项目“mylib”和“myapp”</p>
<ul>
<li>mylib 的项目类型为“iOS -> <strong>Cocoa Touch Framework</strong>” </li>
<li>myapp的项目类型为“iOS -> Application -> <strong>Single View Application</strong>”。</li>
</ul>
<p>这两个项目都依赖于“AFNetworking”,所以我在下面写了Podfile。</p>
<pre><code>workspace 'myapp'
platform :ios,'7.0'
xcodeproj 'myapp/myapp.xcodeproj'
target :myapp do
xcodeproj 'myapp/myapp.xcodeproj'
pod 'AFNetworking', '~> 2.5.4'
end
target :mylib do
xcodeproj 'mylib/mylib.xcodeproj'
pod 'AFNetworking', '~> 2.5.4'
end
</code></pre>
<p>运行“pod install”后,我得到了 <a href="https://github.com/everettjf/cocoapods_two_projects_obj69272" rel="noreferrer noopener nofollow">https://github.com/everettjf/cocoapods_two_projects_obj69272</a> ,并且构建没有错误。</p>
<p>但是当我在“iOS 模拟器”中运行时,控制台窗口中会输出大量警告消息。</p>
<pre><code>objc: Class AFHTTPRequestOperation is implemented in both /Users/everettjf/Library/Developer/Xcode/DerivedData/myapp-exzydcmjfladtpgxcrxfchlkcmux/Build/Products/Debug-iphonesimulator/mylib.framework/mylib and /Users/everettjf/Library/Developer/CoreSimulator/Devices/409F22C7-031F-495C-BE66-EE4712D0D469/data/Containers/Bundle/Application/A94992B7-C057-4842-9B64-D8B8E2E5E4DE/myapp.app/myapp. One of the two will be used. Which one is undefined.
objc: Class AFHTTPRequestOperationManager is implemented in both /Users/everettjf/Library/Developer/Xcode/DerivedData/myapp-exzydcmjfladtpgxcrxfchlkcmux/Build/Products/Debug-iphonesimulator/mylib.framework/mylib and /Users/everettjf/Library/Developer/CoreSimulator/Devices/409F22C7-031F-495C-BE66-EE4712D0D469/data/Containers/Bundle/Application/A94992B7-C057-4842-9B64-D8B8E2E5E4DE/myapp.app/myapp. One of the two will be used. Which one is undefined.
objc: Class AFHTTPSessionManager is implemented in both /Users/everettjf/Library/Developer/Xcode/DerivedData/myapp-exzydcmjfladtpgxcrxfchlkcmux/Build/Products/Debug-iphonesimulator/mylib.framework/mylib and /Users/everettjf/Library/Developer/CoreSimulator/Devices/409F22C7-031F-495C-BE66-EE4712D0D469/data/Containers/Bundle/Application/A94992B7-C057-4842-9B64-D8B8E2E5E4DE/myapp.app/myapp. One of the two will be used. Which one is undefined.
objc: Class AFNetworkActivityIndicatorManager is implemented in both /Users/everettjf/Library/Developer/Xcode/DerivedData/myapp-exzydcmjfladtpgxcrxfchlkcmux/Build/Products/Debug-iphonesimulator/mylib.framework/mylib and /Users/everettjf/Library/Developer/CoreSimulator/Devices/409F22C7-031F-495C-BE66-EE4712D0D469/data/Containers/Bundle/Application/A94992B7-C057-4842-9B64-D8B8E2E5E4DE/myapp.app/myapp. One of the two will be used. Which one is undefined.
...(more)
</code></pre>
<p>我该如何解决?谢谢。</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>最后,我找到了 2 个解决方案。</p>
<ol>
<li><p>解决方案 1</p>
<p>mylib -> TARGETS(mylib) -> build设置 -> 链接 -> Mach-O 类型:静态库</p>
</li>
<li><p>解决方案 2</p>
<p>只需添加“use_frameworks!”到 Podfile </p>
</li>
</ol>
<p>更多信息,请参阅<a href="https://github.com/everettjf/cocoapods_two_projects_obj69272" rel="noreferrer noopener nofollow">here</a> </p></p>
<p style="font-size: 20px;">关于ios - 将 CocoaPods 与 2 个项目一起使用时的运行时输出 objc,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/32109812/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/32109812/
</a>
</p>
页:
[1]