gpt4 book ai didi

ios - 定义与 Swift 2.0 中的先前值冲突

转载 作者:搜寻专家 更新时间:2023-11-01 05:46:43 25 4
gpt4 key购买 nike

我将 Xcode 更新到版本 7 和 Swift 2.0。我的应用程序工作正常,在 Xcode 6 和 Swift 1.2 中没有任何错误。我现在在方法 func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell 中收到错误“定义与先前值冲突”,我看到了“tableView”的先前定义>'在这里

override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if searchPredicate == nil {
return arrayItem.count ?? 0
} else {
return arrayFilterOfNames.count ?? 0
}
}

错误在这里

    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("artistTwo", forIndexPath: indexPath) as! SongsCellArtist

if searchPredicate == nil {
var currentString = arrayItem[indexPath.row]
var urlULTRA: NSURL!
var ultraDirectory = fileManager.URLsForDirectory(NSSearchPathDirectory.DocumentDirectory, inDomains: NSSearchPathDomainMask.UserDomainMask)
if var ultraURL: NSURL = ultraDirectory.first as? NSURL {
urlULTRA = ultraURL.URLByAppendingPathComponent(currentString)
}
var ultraMediaPlayer = AVPlayerItem(URL: urlULTRA)
var ultraCommonMetaData = ultraMediaPlayer.asset.commonMetadata
for ultraData in ultraCommonMetaData {
if ultraData.commonKey == "title" {
// println("ultra data equals \(ultraData.stringValue)")
nameSongForPass = ultraData.stringValue
}
if ultraData.commonKey == "artist" {
nameArtistForPass = ultraData.stringValue
}
if ultraData.commonKey == "album" {
nameAlbumForPass = ultraData.stringValue
}
if ultraData.commonKey == "artwork" {
imageSongForPass = ultraData.dataValue
}
}

cell.nameSong?.text = nameSongForPass
if nameAlbumForPass != nil {
cell.artistAlbumName?.text = "\(nameArtistForPass) - \(nameAlbumForPass)"
} else {
cell.artistAlbumName?.text = "\(nameArtistForPass)"
}

if imageSongForPass != nil {
cell.imageSongs?.image = UIImage(data: imageSongForPass)
} else {
cell.imageSongs?.image = UIImage(named: "Notes100.png")
}
} else {
var name: String! = arrayFilterOfNames[indexPath.row]
cell.nameSong.text = name
}
return cell
}

最佳答案

这绝对是“{}”问题。请检查您是否正确关闭了大括号。

关于ios - 定义与 Swift 2.0 中的先前值冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32647438/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com