[英]iOS Cocoapods issue: No such module in parts of my project (custom folder & Apple Watch target)
我无法正确安装以下cocoapod:github.com/drmohundro/SWXMLHash
有趣的是,我可以在我的常规ViewController.swift中访问由pod安装的框架“SWXMLHash”,但无法在Apple Watch Extension文件中访问它。 此外,我无法在自定义组/文件夹中访问它,以封装辅助方法,如WebServiceHelper.swift
我可以在我的ViewController.swift for iPhone中轻松导入和使用pod提供的框架。 但是当我尝试在包含“ViewController.swift”/“AppDelegate.swift”的文件夹之外访问它时,我收到以下错误:
没有这样的模块'SWXMLHash'
我尝试访问“myAppName Kit”文件夹中的框架时出错(图片链接)
我的Podfile:
# Uncomment this line to define a global platform for your project
# platform :ios, '8.0'
# Uncomment this line if you're using Swift
use_frameworks!
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
pod 'SWXMLHash', '~> 2.1.0'
target 'myAppName' do
end
target 'myAppNameTests' do
end
target 'myAppNameUITests' do
end
target 'myAppName Watch' do
end
target 'myAppName Watch Extension' do
end
非常感谢您的帮助!
请像这样制作podfile
# Uncomment this line to define a global platform for your project
# platform :ios, '8.0'
# Uncomment this line if you're using Swift
use_frameworks!
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
target 'myAppName' do
pod 'SWXMLHash', '~> 2.1.0'
end
target 'myAppNameTests' do
end
target 'myAppNameUITests' do
end
target 'myAppName Watch' do
pod 'SWXMLHash', '~> 2.1.0'
end
target 'myAppName Watch Extension' do
pod 'SWXMLHash', '~> 2.1.0'
end
以下是我认为你的Podfile
看起来的样子( 请注意 ,为了清晰起见,我只指定了iOS和Watch目标,你需要为每个目标包含正确平台所需的任何一个):
use_frameworks!
source 'https://github.com/CocoaPods/Specs.git'
target 'myAppName' do
platform :ios, '8.0'
pod 'SWXMLHash', '~> 2.1.0'
end
# snipped...
target 'myAppName Watch' do
platform :watchos, '2.0'
pod 'SWXMLHash', '~> 2.1.0'
end
我没有为它们中的每一个添加它,但请注意:platform
watch :platform
的指定目标不同。 您不希望ios
目标处于全局级别。
希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.