Quantcast
Channel: Active questions tagged cocoapods - Stack Overflow
Viewing all articles
Browse latest Browse all 1018

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

$
0
0

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.

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.

#ifdef PCH_FILE_IMPORTED_SUCCESSFULLY#error "pch import success!"#else#error "pch import failure!"#endif

xcode build alway get pch import failure!


Viewing all articles
Browse latest Browse all 1018

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>