简体   繁体   English

使用跨应用程序和watchkit扩展程序的拆分pod存档构建

[英]Archive build with split pods across app and watchkit extension

I have been unable to get Cocoapods to build a deployable iOS app that requires different pods for the app and the watchkit extension. 我一直无法让Cocoapods构建可部署的iOS应用程序,该应用程序和Watchkit扩展需要不同的Pod。 I have tried a format suggested in another thread: Include pods in main target and not in WatchKit extension 我尝试了另一种线程中建议的格式: 在主要目标中包含Pod,而不在WatchKit扩展中包含Pod

but it has numerous failures, including not finding headers. 但是它有很多失败,包括找不到标题。 Here's the closest I can get: 这是我能得到的最接近的东西:

source 'https://github.com/CocoaPods/Specs.git'

link_with 'RailTime-WatchKit-Extension'

pod 'Reachability'
pod 'IGInterfaceDataTable'

target :'RailTime', :exclusive=>true do
    pod 'ASIHTTPRequest', '~> 1.8.2'
    pod 'BPXLUUIDHandler', '~> 0.0.1'
    pod 'MBProgressHUD', '~> 0.9'
    pod 'Appirater', '~> 2.0.4'
end

This works fine for the simulator, but fails when trying to install on a device. 这对于模拟器来说效果很好,但是在尝试在设备上安装时失败。 The first error is: 第一个错误是:

ld: library not found for -lPods-RailTime-WatchKit-Extension ld:找不到-lPods-RailTime-WatchKit-Extension的库

I'm using the latest Cocoapods right now .37. 我现在正在使用最新的Cocoapods .37。 No errors are generated when performing a pod install. 执行Pod安装时不会产生任何错误。

Any help would be greatly appreciated! 任何帮助将不胜感激!

Ken

Here's the general format that I use for my WatchKit app. 这是我在WatchKit应用中使用的常规格式。 See if this helps: 看看这是否有帮助:

source 'https://github.com/CocoaPods/Specs.git'

target 'RailTime-WatchKit-Extension' do

link_with 'RailTime-WatchKit-Extension'

pod 'Reachability'
pod 'IGInterfaceDataTable'

end

target :'RailTime' do

link_with 'RailTime'

pod 'ASIHTTPRequest', '~> 1.8.2'
pod 'BPXLUUIDHandler', '~> 0.0.1'
pod 'MBProgressHUD', '~> 0.9'
pod 'Appirater', '~> 2.0.4'

end

OK, the solution was quite simple, even though I'm not sure why it worked. 好的,解决方案非常简单,尽管我不确定为什么会起作用。 As suggested in another thread, I did a 'pod init', which now creates a template that is knowledgable about the multiple targets. 正如在另一个线程中所建议的那样,我做了一个“ pod init”,现在它创建了一个可了解多个目标的模板。 I then just filled it in! 然后我就把它填满了! Here's what I have now: 这是我现在所拥有的:

platform :ios, '8.2'
source 'https://github.com/CocoaPods/Specs.git'

target 'RailTime' do
    pod 'Reachability'
    pod 'ASIHTTPRequest', '~> 1.8.2'
    pod 'BPXLUUIDHandler', '~> 0.0.1'
    pod 'MBProgressHUD', '~> 0.9'
    pod 'Appirater', '~> 2.0.4'
end

target 'RailTime-WatchKit-Extension' do
    pod 'Reachability'
    pod 'IGInterfaceDataTable'
end

target 'RailTime-WatchKit-App' do

end

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM