簡體   English   中英

iOS Cocoapods問題:我的項目部分沒有這樣的模塊(自定義文件夾和Apple Watch目標)

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM