ios – 未定义的符号Swift.UnsafeMutableBufferPointer

下载 Xcode 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
}

解决了你的问题吗?

相关文章

背景 前端时间产品经理决定使用百度统计,使得 工程B 中原统计sdk-友盟统计,需要被去除。之前尝试去除...
结论: alloc负责分配内存和创建对象对应的isa指针; init只是返回alloc生成的对象。 所以alloc后,多次...
更新 如果UI愿意把启动图切割成n份,按一定约束在launchscreen.storyboard中进行排版,启动图效果会更好...
最近在看一本书《Effective OC 2.0》,今天看到有个tip是OC适中循环各自优劣性,作者最终推荐此块循环。...
// // ViewController.m // paintCodeTestOC //gif // Created by LongMa on 2019/7/25. // #import &a...
背景介绍 一般情况下,出于省电、权限、合理性等因素考虑,给人的感觉是很多奇怪的需求安卓可以实现,但...