仅将子集的子集用于子目标

时间:2018-04-23 11:31:19

标签: ios cocoapods ios8-share-extension ios-targets

是否有办法仅为应用的子目标使用pod子集(例如我的应用的共享扩展名)

我试过这样做:

platform :ios, '8.0'
inhibit_all_warnings!
I18n.enforce_available_locales = false

def all_pods
    pod 'AFNetworking', '~> 2.3'
    pod 'AFNetworkActivityLogger', '~> 2.0.2'
    pod 'TPKeyboardAvoiding', '~> 1.2.3'
    pod 'SMPageControl', '~> 1.2'
    pod 'MLPAutoCompleteTextField', :git => 'https://github.com/EddyBorja/MLPAutoCompleteTextField.git', :branch => 'master'
    pod 'UIImage-Resize', '~> 1.0.1'
    pod 'M13BadgeView', '~> 1.0.0'
    pod 'CWStatusBarNotification', '~> 2.3.3'
end

target 'Lohi Connect' do
    all_pods
    target 'Lohi Connect Share' do
       pod 'MLPAutoCompleteTextField', :git => 'https://github.com/EddyBorja/MLPAutoCompleteTextField.git', :branch => 'master'
    end
end

然而,当我尝试构建我的应用时,似乎所有广告连播都用于共享扩展,这会导致崩溃,因为某些广告连播使用[UIApplication sharedApplication],这在共享扩展程序中不可用

1 个答案:

答案 0 :(得分:1)

在分配第二个目标之前,您必须结束一个目标的实例。

请用以下代码替换上述代码:

platform :ios, '8.0'
inhibit_all_warnings!
I18n.enforce_available_locales = false

def all_pods
    pod 'AFNetworking', '~> 2.3'
    pod 'AFNetworkActivityLogger', '~> 2.0.2'
    pod 'TPKeyboardAvoiding', '~> 1.2.3'
    pod 'SMPageControl', '~> 1.2'
    pod 'MLPAutoCompleteTextField', :git => 'https://github.com/EddyBorja/MLPAutoCompleteTextField.git', :branch => 'master'
    pod 'UIImage-Resize', '~> 1.0.1'
    pod 'M13BadgeView', '~> 1.0.0'
    pod 'CWStatusBarNotification', '~> 2.3.3'
end

target 'Lohi Connect' do
    all_pods
end
target 'Lohi Connect Share' do
       pod 'MLPAutoCompleteTextField', :git => 'https://github.com/EddyBorja/MLPAutoCompleteTextField.git', :branch => 'master'
end