将cocoapod部件包含在不同的目标中

时间:2015-11-25 00:10:36

标签: cocoapods objective-c-blocks target

我对CocoaPods的兼容性存在问题。我已经坚持了一个星期。我需要我的应用程序才能使用iOS8 +和扩展目标来使用iOS9 +。
+我删除并重新添加了所有pod文件,工作区等 - 没有用。没什么!
+我有链接和无关联的目标 - 没有用。
+我尝试过在pods target&项目目标 - 没有用。
+我试过更改标题搜索路径 - 没有用。

当前状态

以下是我的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>个文件   找不到#import <BlocksKit/NSObject+A2DynamicDelegate.h>个文件


同时,我在调试和调试的每个目标中都收到了警告。发布版本:

  

无法打开文件“Pods.debug.xcconfig”,因为没有   这样的文件。 (... / MainProject / Pods / Target Support   文件/荚/ Pods.debug.xcconfig)

因此,即使存储在一个文件夹中,也找不到Pod中的部分文件。

enter image description here

1 个答案:

答案 0 :(得分:0)

通过重建工作区的体系结构并调整Xcode项目包的内容来解决。

相关问题