我試圖爲我的ios應用程序和ios手錶套件使用一個框架(Realm.framework)。 我嘗試了很多方法,但都沒有成功。任何人都可以給我一個如何編寫一個pod文件來共享iOS應用程序和手錶應用程序之間的框架的例子嗎?如何使用cocoapod爲ios應用程序和手錶擴展程序包含共享框架
隨着出莢文件中的任何表擴張對象,我得到了一個錯誤說:
Target 'Realm' of project 'Pods' was rejected as an implicit dependency for 'Realm.framework' because it doesn't contain platform 'watchsimulator' in its SUPPORTED_PLATFORMS 'iphonesimulator, iphoneos'
Target 'RealmSwift' of project 'Pods' was rejected as an implicit dependency for 'RealmSwift.framework' because it doesn't contain platform 'watchsimulator' in its SUPPORTED_PLATFORMS 'iphonesimulator, iphoneos'
Target 'Pods' of project 'Pods' was rejected as an implicit dependency for 'Pods.framework' because it doesn't contain platform 'watchsimulator' in its SUPPORTED_PLATFORMS 'iphonesimulator, iphoneos'
然後我說目標手錶擴展到我莢文件。這裏是我的POD文件:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
link_with 'myApp', 'myApp Watch Extension'
def shared_pods
pod 'RealmSwift'
end
target 'myApp' do
podspec :path => 'myapp.podspec'
pod 'SnapKit'
pod 'ChameleonFramework/Swift'
pod 'Google-Mobile-Ads-SDK'
shared_pods
end
target 'myApp Watch Extension' do
podspec :path => 'myapp.podspec'
platform :watchos, '2.0'
shared_pods
end
我把它與「吊艙安裝」警告跑,但我的工作空間無法運行。
2015-12-07 15:45:46.402 ruby[17042:4339468] warning: The file reference for "Realm.framework" is a member of multiple groups ("Products" and "Products"); this indicates a malformed project. Only the membership in one of the groups will be preserved (but membership in targets will be unaffected). If you want a reference to the same file in more than one group, please add another reference to the same path.
2015-12-07 15:45:46.402 ruby[17042:4339468] warning: The file reference for "RealmSwift.framework" is a member of multiple groups ("Products" and "Products"); this indicates a malformed project. Only the membership in one of the groups will be preserved (but membership in targets will be unaffected). If you want a reference to the same file in more than one group, please add another reference to the same path.
我的Pods-myApp Watch Extension-Realm文件有太多錯誤。
我也試着像豆莢文件: 「[!]目標不同的平臺」
source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
link_with 'myApp', 'myApp Watch Extension'
def shared_pods
pod 'RealmSwift'
end
target 'myApp' do
podspec :path => 'myapp.podspec'
platform :ios, '8.0'
pod 'SnapKit'
pod 'ChameleonFramework/Swift'
pod 'Google-Mobile-Ads-SDK'
shared_pods
end
target 'myApp Watch Extension' do
podspec :path => 'myapp.podspec'
platform :watchos, '2.0'
shared_pods
end
然後我得到了錯誤。
在我podspec,我已經添加行:
s.platform = :ios
s.platform = :ios, "8.0"
s.platform = :watchos
s.platform = :watchos, "2.0"
誰能告訴我應該如何辦呢?