【发布时间】:2020-03-04 04:40:39
【问题描述】:
我在我的Nativescript 应用中添加了一个共享扩展,这个扩展需要一个 Pod。
所以我需要修改 Nativescript 应用程序的 Podfile 以使用所需的 Pod 来定位我的共享扩展,如下:
target :MyApp do
platform :ios, '8.0'
use_frameworks!
pod 'AFNetworking', '~> 2.0'
pod '...'
end
target :MyExtension do
use_frameworks!
pod 'AFNetworking', '~> 2.0'
end
post_install do |installer_representation|
installer_representation.pods_project.targets.each do |target|
if target.name.start_with? "Pods-MyExtension"
target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', 'AF_APP_EXTENSIONS=1']
end
end
end
end
这里的问题是每次运行项目时,Podfile都会被Nativescript覆盖。
那么,有一种方法可以“阻止” Podfile 以防止 Nativescript 覆盖它,或者在 Nativescript Podfile 生成之后将自定义内容添加到 Podfile 的“钩子”?
我该如何处理?
谢谢。
【问题讨论】:
-
你说的是哪个 PodFile,你的应用程序/插件可以有它自己的 PodFile,你不应该修改平台目录中的任何东西。
-
@Manoj 我说的不是插件,而是应用扩展,我几乎可以肯定应用扩展不能有独立的 Podfile。所以我需要在构建时以某种方式修改应用程序 Podfile。
标签: ios nativescript podfile share-extension