【问题标题】:Modify Podfile in Nativescript application在 Nativescript 应用程序中修改 Podfile
【发布时间】: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


【解决方案1】:

为了修改构建时在平台文件夹中生成的 Podfile,您可以在 App_Resources/iOS 文件夹中添加一个 Podfile。

App_Resources/iOS 文件夹中的 Podfile 将与平台文件夹中生成的 Podfile 合并。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-02-11
    • 2021-11-27
    • 1970-01-01
    • 2019-12-18
    • 1970-01-01
    • 2021-05-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多