例子:
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并没有生效:

对Pods targets 都有效:

#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起到作用:


网友评论