ios - 如何为 iOS 扩展定义 pod 文件
<p><p>当如下定义我的 Podfile,然后使用我的扩展构建我的应用程序时,我在 DKImagePickerController 框架中遇到构建错误,错误类似于:<a href="https://stackoverflow.com/questions/32031071/error-sharedapplication-is-unavailable-not-available-on-ios-app-extension" rel="noreferrer noopener nofollow">Error "'sharedApplication' is unavailable: not available on iOS (App Extension)...." when compiling after pod update</a> </p>
<p>如您所见,我没有在我的 Podfile 的扩展目标中包含 DKImagePickerController 框架,所以我想知道我做错了什么?</p>
<pre><code> platform :ios, '10.0'
def base_pods
pod 'Firebase/Core'
pod 'Firebase/Auth'
pod 'DKImagePickerController', '~> 3.4.0'
...
pod 'SAMKeychain'
end
target 'MyApp' do
use_frameworks!
base_pods
target 'MyAppExtension' do
pod 'Firebase/Auth'
pod 'SAMKeychain'
end
target 'MyAppUnitTests' do
inherit! :search_paths
pod 'Firebase'
pod 'FirebaseAuth'
pod 'FirebaseUI/Auth'
end
end
</code></pre>
<p><strong>更新</strong></p>
<p>我很感激由于 API 不可用而收到错误,我想弄清楚的是如何避免它。我怀疑我的播客文件,因此我的问题:)</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>我遇到了同样的问题,所以对于找到此线程的其他人,我能够通过创建两个顶级目标而不是使用嵌套目标来解决问题。</p>
<pre><code>target 'MyApp' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for MyApp
pod 'Eureka', '~> 3.0'
pod 'ChameleonFramework', '~> 2.0'
pod 'SharedPod', '~>1.0'
target 'MyAppTests' do
inherit! :search_paths
# Pods for testing
end
target 'MyAppUITests' do
inherit! :search_paths
# Pods for testing
end
end
target 'MyApp Today' do
use_frameworks!
# inherit! :none
# Pods for MyApp Today
pod 'SharedPod', '~>1.0'
end
</code></pre>
<p>为了有个干净的开始,我跑了......</p>
<pre><code>pod deintegrate
-- Then cleaned out the project file in XCode
pod install
</code></pre></p>
<p style="font-size: 20px;">关于ios - 如何为 iOS 扩展定义 pod 文件,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/41778458/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/41778458/
</a>
</p>
页:
[1]