在不同的目标中包含 cocoapod 部分
Include cocoapod parts in different targets
我对 CocoaPods 兼容性有疑问。我已经坚持了一个星期。我需要我的应用程序在 iOS8+ 上工作,扩展目标与 iOS9+ 一起工作。
+ 我已经删除并且 re-added 所有 pod 文件、工作区等 - 没有用。没什么!
+ 我有链接和取消链接的目标 - 没有用。
+ 我试过在 pods 目标和项目目标中切换标志 - 没有用。
+ 我试过更改 header 搜索路径 - 没用。
当前状态
这是我的 Pods 目标 Manifest.lock
diff "${SRCROOT}/Podfile.lock" "${SRCROOT}/Pods/Manifest.lock" > /dev/null
if [[ $? != 0 ]] ; then
cat << EOM
error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.
EOM
exit 1
fi
这是我的 Pods 文件:
###############################################################
#################################### Intro
###############################################################
source 'https://github.com/CocoaPods/Specs.git'
#use_frameworks!
#workspace 'MainProject.xcworkspace'
inhibit_all_warnings!
link_with 'MainProject', 'ExtensionProject'
platform :ios, '8.0'
###############################################################
#################################### Shared definitions
###############################################################
def sharedData
pod 'BlocksKit/Core'
pod 'BlocksKit/DynamicDelegate'
end
###############################################################
#################################### Pods
###############################################################
target 'ExtensionProject' do
sharedData
end
target 'MainProject' do
sharedData
pod 'BlocksKit/MessageUI'
pod 'BlocksKit/UIKit'
end
###############################################################
#################################### Pre & Post Installs
###############################################################
post_install do |installer_representation|
installer_representation.pods_project.targets.each do |target|
target.build_configurations.each do |config|
# All the targets should have this parameter set to NO.
puts "#{target}, #{config} configuration..."
config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
config.build_settings['HEADER_SEARCH_PATHS'] ||= ['$(inherited)']
config.build_settings['VALID_ARCHS'] ||= ['armv6','armv7','armv7s','arm64', 'x86_64']
config.build_settings['ARCHS'] ||= ['armv7','armv7s']
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
config.build_settings['OTHER_LDFLAGS'] ||= ['$(inherited)']
config.build_settings['OTHER_LDFLAGS'] << '-ObjC'
#config.build_settings['OTHER_LDFLAGS'] << '-all_load'
config.build_settings['LD_RUNPATH_SEARCH_PATHS'] ||= ['$(inherited)']
config.build_settings['PODS_ROOT'] = '${SRCROOT}/Pods'
end
end
end
当前问题
现在的错误如下(在A2DynamicDelegate.h内):
#import <BlocksKit/NSObject+A2BlockDelegate.h>
file not found
#import <BlocksKit/NSObject+A2DynamicDelegate.h>
file not found
同时,我在构建的调试和发布版本的每个目标中都收到这样的警告:
The file “Pods.debug.xcconfig” couldn’t be opened because there is no
such file. (.../MainProject/Pods/Target Support
Files/Pods/Pods.debug.xcconfig)
因此,Pod 中的部分文件找不到,即使存储在一个文件夹中。
已通过重建工作区的体系结构和调整 Xcode 项目包的内容来修复。
我对 CocoaPods 兼容性有疑问。我已经坚持了一个星期。我需要我的应用程序在 iOS8+ 上工作,扩展目标与 iOS9+ 一起工作。
+ 我已经删除并且 re-added 所有 pod 文件、工作区等 - 没有用。没什么!
+ 我有链接和取消链接的目标 - 没有用。
+ 我试过在 pods 目标和项目目标中切换标志 - 没有用。
+ 我试过更改 header 搜索路径 - 没用。
当前状态
这是我的 Pods 目标 Manifest.lock
diff "${SRCROOT}/Podfile.lock" "${SRCROOT}/Pods/Manifest.lock" > /dev/null
if [[ $? != 0 ]] ; then
cat << EOM
error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.
EOM
exit 1
fi
这是我的 Pods 文件:
###############################################################
#################################### Intro
###############################################################
source 'https://github.com/CocoaPods/Specs.git'
#use_frameworks!
#workspace 'MainProject.xcworkspace'
inhibit_all_warnings!
link_with 'MainProject', 'ExtensionProject'
platform :ios, '8.0'
###############################################################
#################################### Shared definitions
###############################################################
def sharedData
pod 'BlocksKit/Core'
pod 'BlocksKit/DynamicDelegate'
end
###############################################################
#################################### Pods
###############################################################
target 'ExtensionProject' do
sharedData
end
target 'MainProject' do
sharedData
pod 'BlocksKit/MessageUI'
pod 'BlocksKit/UIKit'
end
###############################################################
#################################### Pre & Post Installs
###############################################################
post_install do |installer_representation|
installer_representation.pods_project.targets.each do |target|
target.build_configurations.each do |config|
# All the targets should have this parameter set to NO.
puts "#{target}, #{config} configuration..."
config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
config.build_settings['HEADER_SEARCH_PATHS'] ||= ['$(inherited)']
config.build_settings['VALID_ARCHS'] ||= ['armv6','armv7','armv7s','arm64', 'x86_64']
config.build_settings['ARCHS'] ||= ['armv7','armv7s']
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
config.build_settings['OTHER_LDFLAGS'] ||= ['$(inherited)']
config.build_settings['OTHER_LDFLAGS'] << '-ObjC'
#config.build_settings['OTHER_LDFLAGS'] << '-all_load'
config.build_settings['LD_RUNPATH_SEARCH_PATHS'] ||= ['$(inherited)']
config.build_settings['PODS_ROOT'] = '${SRCROOT}/Pods'
end
end
end
当前问题
现在的错误如下(在A2DynamicDelegate.h内):
#import <BlocksKit/NSObject+A2BlockDelegate.h>
file not found
#import <BlocksKit/NSObject+A2DynamicDelegate.h>
file not found
同时,我在构建的调试和发布版本的每个目标中都收到这样的警告:
The file “Pods.debug.xcconfig” couldn’t be opened because there is no such file. (.../MainProject/Pods/Target Support Files/Pods/Pods.debug.xcconfig)
因此,Pod 中的部分文件找不到,即使存储在一个文件夹中。
已通过重建工作区的体系结构和调整 Xcode 项目包的内容来修复。