I have trouble installing following cocoapod correctly: github.com/drmohundro/SWXMLHash
Interestingly enough, I can access the framework "SWXMLHash" installed by the pod in my regular ViewController.swift but cannot access it in my Apple Watch Extension files. Furthermore, I cannot access it in a custom group/folder I made to encapsulate the helper methods like WebServiceHelper.swift
Overview of my folder structure (Image link)
I can easily import and use the framework provided by the pod in my ViewController.swift for iPhone . But when I try to access it outside the folder containing "ViewController.swift" / "AppDelegate.swift" I get following error:
No such module 'SWXMLHash'
Error when I try to access the framework in my "myAppName Kit"-folder (Image link)
My 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
Thank you very much for your help!
please make podfile like this
# 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
Here's how I think your Podfile
should look ( note that I only specified the iOS and Watch targets for clarity, you'll need to include whichever ones are necessary with the correct platform for each):
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
I didn't add it for every one of them, but note that the :platform
is specified differently for the watch target. You don't want the ios
target at the global level.
Hope this helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.