美文网首页
2024-04-01 installer.pods_projec

2024-04-01 installer.pods_projec

作者: 我是小胡胡分胡 | 来源:发表于2024-03-31 11:38 被阅读0次

    例子:

    https://github.com/hc2088/libtest

    post_install do |installer|
      installer.pods_project.targets.each do |target|
     
        puts target.name
        target.build_configurations.each do |config|
          puts config.name
          config.build_settings["IPHONEOS_DEPLOYMENT_TARGET"] = "12.0"
          config.build_settings['SWIFT_VERSION'] = '5.0'
          config.build_settings['ENABLE_BITCODE'] = 'NO'
          config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
          config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
            '$(inherited)',
            'AUDIO_SESSION_MICROPHONE=1',
          ]
        end
      end
    end
    
    

    执行pod install
    输出:

     pod install
    Analyzing dependencies
    Downloading dependencies
    Generating Pods project
    Libtest
    Release
    Debug
    Pods-test
    Release
    Debug
    Integrating client project
    

    installer.pods_project.targets.each do |target|这里的target只执行了2遍:
    Libtest
    Pods-test
    并没有test壳工程自身?

    对壳工程本身这里是test 这个target并没有生效:


    image.png

    对Pods targets 都有效:

    image.png
    
    #import <LibTest/Test.h>
    
    @interface AppDelegate ()
    
    @end
    
    @implementation AppDelegate
    
    
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
        // Override point for customization after application launch.
        [Test test];
        return YES;
    }
    
    
    
    @implementation Test
    +(void)test{
        
    #if AUDIO_SESSION_MICROPHONE
        NSLog(@"定义了AUDIO_SESSION_MICROPHONE");
    #else
        NSLog(@"没有定义");
    #endif
    }
    @end
    
    

    EXCLUDED_ARCHS

    同样也没有对壳工程的target起到作用:


    image.png
    image.png

    相关文章

      网友评论

          本文标题:2024-04-01 installer.pods_projec

          本文链接:https://www.haomeiwen.com/subject/xaovtjtx.html