有没有办法只将 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
然而,当我尝试构建我的应用程序时,似乎所有 pod 都用于共享扩展,这会导致崩溃,因为某些 pod 使用 [UIApplication sharedApplication]
在共享扩展中不可用
最佳答案
在分配第二个目标之前,您必须结束一个目标的实例。
请用以下代码替换上面的代码:
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
关于ios - 仅将 pod 的子集用于子目标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49980070/