2016-10-20 94 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