2016-10-20 42 views
8

下载Xcode 8并迁移到Swift 3后,我不再能够归档该项目。同时该项目建设没有任何问题。未定义的符号Swift.UnsafeMutableBufferPointer

错误,我得到:

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, subRange : Swift.Range, by : inout (A.Iterator.Element, 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排序数据解决的问题,我不喜欢这个解决方案。

将不胜感激的任何建议。

+0

在更改之前发布您的代码也 – Kuba

回答

1

更新到XCode 8.1后问题消失。 谢谢大家:)

1

如果这里只为这条线是问题:

let sortedResults = results.sorted(by: { $0.fileIndex < $1.fileIndex }) 

你可以改变它:

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

它是否解决问题了吗?

+0

我有完全相同的问题,这并没有为我工作。普通的'array.sort()'(我的只是一个'Float'的数组) – ephemer

1

因为它编译我不认为你的代码有什么问题。事实上,它表示“未定义的架构armv7符号”并且无法存档,这告诉我您的项目正在发生一些事情,但不幸的是有很多方法可以解决这个问题。 arm7是iphone 5,所以你的项目可能只是为arm64正确设置。试试这里提到的解决方案:Undefined symbols for architecture armv7