ios – 未定义的符号Swift.UnsafeMutableBufferPointer

前端之家收集整理的这篇文章主要介绍了ios – 未定义的符号Swift.UnsafeMutableBufferPointer前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
下载 @L_502_0@ 8并迁移到 Swift 3后,我无法再归档项目.同时,项目建立没有任何问题.

我得到的错误

Undefined symbols for architecture armv7:
“Swift.UnsafeMutableBufferPointer.(subscript.materializeForSet :
(Swift.Int) -> A).(closure #1)”,referenced from:
function signature specialization of generic specialization

with
Swift.UnsafeMutableBufferPointer :
Swift.MutableCollection in Swift and
Swift.UnsafeMutableBufferPointer :
Swift.RandomAccessCollection in Swift> of Swift._siftDown (inout A,
index : A.Index,subRange : Swift.Range,by : inout
(A.Iterator.Element,A.Iterator.Element) -> Swift.Bool) -> () in
OrderCoordinator.o
function signature specialization of generic specialization

with
Swift.UnsafeMutableBufferPointer :
Swift.MutableCollection in Swift and
Swift.UnsafeMutableBufferPointer :
Swift.RandomAccessCollection in Swift> of Swift._heapSort (inout A,
subRange : Swift.Range,by : inout (A.Iterator.Element,
A.Iterator.Element) -> Swift.Bool) -> () in OrderCoordinator.o
function signature specialization of generic specialization

with
Swift.UnsafeMutableBufferPointer :
Swift.MutableCollection in Swift and
Swift.UnsafeMutableBufferPointer :
Swift.RandomAccessCollection in Swift> of Swift._partition (inout A,
A.Iterator.Element) -> Swift.Bool) -> A.Index in OrderCoordinator.o
ld: symbol(s) not found for architecture armv7 clang: error: linker
command Failed with exit code 1 (use -v to see invocation)

通过在以下函数中注释数组排序代码,我能够摆脱错误

func didFinishWithResults(_ results: [PhotoProcessorResult]) {
    guard let album = albumService.currentAlbum else { return }
    //let sortedResults = results.sorted(by: { $0.fileIndex < $1.fileIndex })
    let updateItems = zip(sortedResults,album.assetItems).map { (photoProcessorResult,assetItem) -> UpdateItem in
        UpdateItem(path: photoProcessorResult.filePath,position: photoProcessorResult.fileIndex,isCover: assetItem.isCover)
    }
    albumService.updateAlbumWithItems(updateItems) { (success,errorDescription) in
        if success {
            self.handleAlbumUpdate()
        } else {
            self.showFailureAlert(errorDescription) {
                self.startProcessingAlbum(self.albumService.currentAlbum)
            }
        }
    }
}

虽然我通过使用NSArray对数据进行排序来解决问题,但我不喜欢这种解决方案.

将不胜感激任何建议.

解决方法

如果此问题仅适用于此行:
let sortedResults = results.sorted(by: { $0.fileIndex < $1.fileIndex })

你可以改成它:

let sortedResults = results.sorted { (first,second) -> Bool in
    return first.fileIndex < second.fileIndex
}

解决了你的问题吗?

猜你在找的iOS相关文章