Does the prefix_header_contents in CocoaPods refer to the definition of a precompiled header that is included during compilation process?

I have a standalone iOS project that currently needs to be converted into a framework. My goal is to directly integrate this native project into a KMM (Kotlin Multiplatform Mobile) setup, where the Android side has already been accomplished with build scripts. As a git submodule, the project can operate independently and also function as a component within the KMM project.

Now, I’m focusing on the iOS part. I’ve defined a podspec via a Gradle script and attempted to use it in an empty project through CocoaPods dependency.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>Pod::Spec.new do |s|
s.name = 'UoocOnlines'
s.version = '1.0.0'
s.summary = 'UoocOnlines'
s.homepage = 'http://www.example.com'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'Uooc' => 'vicky leu' }
s.source = { :path=> '.'}
s.ios.deployment_target = '12.0'
s.static_framework = true
# 源代码
s.source_files = 'UoocOnlines/AllClassFiles/**/*.{h,m,swift}'
s.public_header_files = 'UoocOnlines/AllClassFiles/**/*.h'
# 排除文件
s.exclude_files = 'UoocOnlines/*.{plist}'
s.preserve_paths = 'AllClassFiles/**/*.{h,m,swift}'
# 图片资源
s.resource_bundles = {
'UoocOnlines' => ['UoocOnlines/*.{xcassets}', 'UoocOnlines/Lottie*/**/*.{json,png}', 'UoocOnlines/*.{lproj}', 'UoocOnlines/*.{html,mp3}', 'UoocOnlines/Plv/**/Resources/*.{bundle}']
}
s.requires_arc = true
# 公共头文件导进组件.pch文件中
s.prefix_header_contents = <<-PCH
#ifndef PCH_FILE_IMPORTED_SUCCESSFULLY
#define PCH_FILE_IMPORTED_SUCCESSFULLY
#endif
#import "UoocOnlines-Bridging-Header.h"
#import "HNHTTPRequestManager.h"
#import <YYText/YYText.h>
PCH
# 依赖系统Frameworks
s.ios.frameworks = 'Foundation', 'UIKit', 'CoreFoundation', 'CoreTelephony', 'QuartzCore', 'CoreData'
# 依赖系统动态.tdb
s.libraries = 'z', 'sqlite3', 'c++'
s.xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited)' }
s.pod_target_xcconfig = {
'GCC_C_LANGUAGE_STANDARD' => 'gnu99',
'GCC_CXX_LANGUAGE_STANDARD' => 'gnu++14'
}
s.swift_version = '5.0'
# other links flags | bitcode
s.xcconfig = { "OTHER_LDFLAGS" => "-ObjC", "ENABLE_BITCODE" => "NO"}
# 依赖
s.dependency 'Masonry'
s.dependency 'SVGAPlayer'
s.dependency 'Protobuf'
end
</code>
<code>Pod::Spec.new do |s| s.name = 'UoocOnlines' s.version = '1.0.0' s.summary = 'UoocOnlines' s.homepage = 'http://www.example.com' s.license = { :type => 'MIT', :file => 'LICENSE' } s.author = { 'Uooc' => 'vicky leu' } s.source = { :path=> '.'} s.ios.deployment_target = '12.0' s.static_framework = true # 源代码 s.source_files = 'UoocOnlines/AllClassFiles/**/*.{h,m,swift}' s.public_header_files = 'UoocOnlines/AllClassFiles/**/*.h' # 排除文件 s.exclude_files = 'UoocOnlines/*.{plist}' s.preserve_paths = 'AllClassFiles/**/*.{h,m,swift}' # 图片资源 s.resource_bundles = { 'UoocOnlines' => ['UoocOnlines/*.{xcassets}', 'UoocOnlines/Lottie*/**/*.{json,png}', 'UoocOnlines/*.{lproj}', 'UoocOnlines/*.{html,mp3}', 'UoocOnlines/Plv/**/Resources/*.{bundle}'] } s.requires_arc = true # 公共头文件导进组件.pch文件中 s.prefix_header_contents = <<-PCH #ifndef PCH_FILE_IMPORTED_SUCCESSFULLY #define PCH_FILE_IMPORTED_SUCCESSFULLY #endif #import "UoocOnlines-Bridging-Header.h" #import "HNHTTPRequestManager.h" #import <YYText/YYText.h> PCH # 依赖系统Frameworks s.ios.frameworks = 'Foundation', 'UIKit', 'CoreFoundation', 'CoreTelephony', 'QuartzCore', 'CoreData' # 依赖系统动态.tdb s.libraries = 'z', 'sqlite3', 'c++' s.xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited)' } s.pod_target_xcconfig = { 'GCC_C_LANGUAGE_STANDARD' => 'gnu99', 'GCC_CXX_LANGUAGE_STANDARD' => 'gnu++14' } s.swift_version = '5.0' # other links flags | bitcode s.xcconfig = { "OTHER_LDFLAGS" => "-ObjC", "ENABLE_BITCODE" => "NO"} # 依赖 s.dependency 'Masonry' s.dependency 'SVGAPlayer' s.dependency 'Protobuf' end </code>
Pod::Spec.new do |s|
          s.name = 'UoocOnlines'
          s.version = '1.0.0'
          s.summary = 'UoocOnlines'
          s.homepage = 'http://www.example.com'
          s.license = { :type => 'MIT', :file => 'LICENSE' }
          s.author = { 'Uooc' => 'vicky leu' }
          s.source  = { :path=> '.'}
          s.ios.deployment_target    = '12.0'
          s.static_framework = true
          # 源代码
          s.source_files = 'UoocOnlines/AllClassFiles/**/*.{h,m,swift}'
          s.public_header_files = 'UoocOnlines/AllClassFiles/**/*.h'
          # 排除文件
          s.exclude_files = 'UoocOnlines/*.{plist}'
          s.preserve_paths = 'AllClassFiles/**/*.{h,m,swift}'
          # 图片资源
          s.resource_bundles = {
            'UoocOnlines' => ['UoocOnlines/*.{xcassets}', 'UoocOnlines/Lottie*/**/*.{json,png}', 'UoocOnlines/*.{lproj}', 'UoocOnlines/*.{html,mp3}', 'UoocOnlines/Plv/**/Resources/*.{bundle}']
          }
          s.requires_arc            = true
          
          # 公共头文件导进组件.pch文件中
         s.prefix_header_contents =  <<-PCH
             #ifndef PCH_FILE_IMPORTED_SUCCESSFULLY
                #define PCH_FILE_IMPORTED_SUCCESSFULLY
             #endif
             #import "UoocOnlines-Bridging-Header.h"    
             #import "HNHTTPRequestManager.h"
             #import <YYText/YYText.h>
         PCH
          # 依赖系统Frameworks
          s.ios.frameworks = 'Foundation', 'UIKit', 'CoreFoundation', 'CoreTelephony', 'QuartzCore', 'CoreData'
          # 依赖系统动态.tdb
          s.libraries = 'z', 'sqlite3', 'c++'
          s.xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited)' }
          s.pod_target_xcconfig = {
            'GCC_C_LANGUAGE_STANDARD' => 'gnu99',
            'GCC_CXX_LANGUAGE_STANDARD' => 'gnu++14'
          }
          s.swift_version = '5.0'
          # other links flags | bitcode
          s.xcconfig = { "OTHER_LDFLAGS" => "-ObjC", "ENABLE_BITCODE" => "NO"}
          # 依赖
          s.dependency 'Masonry' 
          s.dependency 'SVGAPlayer' 
          s.dependency 'Protobuf' 
end

Upon inspecting the Build Settings of the ‘UoocOnlines’ target within the Pods Project in Xcode, I found:

‘Precompile Prefix Header’ is set to ‘YES’
‘GCC_PRECOMPILE_PREFIX_HEADER’ is ‘YES’
Furthermore, it indicates that:

‘GCC_PREFIX_HEADER’ is set to ‘${PODS_TARGET_SRCROOT}/UoocOnlines/Supporting Files/UoocOnlines-prefix.pch’
Indeed, within the ‘Pods/Development Pods/UoocOnlines/Supporting Files/’ directory, I find the ‘UoocOnlines-prefix.pch’ file which was defined via prefix_header_contents.

However, the macro ‘PCH_FILE_IMPORTED_SUCCESSFULLY’ that I defined in the pch file does not seem to be taking effect in other header files within this pod.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>#ifdef PCH_FILE_IMPORTED_SUCCESSFULLY
#error "pch import success!"
#else
#error "pch import failure!"
#endif
</code>
<code>#ifdef PCH_FILE_IMPORTED_SUCCESSFULLY #error "pch import success!" #else #error "pch import failure!" #endif </code>
#ifdef PCH_FILE_IMPORTED_SUCCESSFULLY
#error "pch import success!"
#else
#error "pch import failure!"
#endif

xcode build alway get pch import failure!

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật