我正在尝试通过podfile安装和使用 SwiftyXMLParser (https://github.com/yahoojapan/SwiftyXMLParser)。 pod文件安装库没有任何问题,但是一旦我在源代码中使用import语句并构建项目,我就会收到大量错误以及消息"No such module SwiftyXMLParser"
我正在使用 Xcode 7 和 Swift 2.3 ,我的podfile看起来像这样。
Podfile
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
target 'ApplePaySwag' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for ApplePaySwag
pod 'SwiftyXMLParser', :git => 'https://github.com/yahoojapan/SwiftyXMLParser.git'
target 'ApplePaySwagTests' do
inherit! :search_paths
# Pods for testing
end
end
答案 0 :(得分:1)
把``pod' SwiftyXMLParser',:git => ' https://github.com/yahoojapan/SwiftyXMLParser.git'`
之前 # Pods for ApplePaySwag
答案 1 :(得分:0)
您需要指定“swift2.3”分支。因为Cocoapods上的SwiftyXMLParser仅支持Swift 3。
override func viewDidLoad() {
super.viewDidLoad()
trackLbl.text = "Track \(trackID + 1)"
// 1
let path: String! = Bundle.main.resourcePath?.appending("/\(trackID!).mp3")
let mp3URL = NSURL(fileURLWithPath: path)
do
{
// 2
audioPlayer = try AVAudioPlayer(contentsOf: mp3URL as URL)
audioPlayer.play()
// 3
Timer.scheduledTimer(timeInterval: 1.0, target: self, selector: #selector(updateAudioProgressView), userInfo: nil, repeats: true)
progressView.setProgress(Float(audioPlayer.currentTime/audioPlayer.duration), animated: false)
}
catch
{
print("An error occurred while trying to extract audio file")
}
}