下载Xcode 8并迁移到Swift 3后,我无法再归档项目.同时,项目建立没有任何问题.
我得到的错误:
体系结构armv7的未定义符号:
"Swift.UnsafeMutableBufferPointer.(subscript.materializeForSet:(Swift.Int) - > A).(closure#1)",引自:Swift.UnsafeMutableBufferPointer的泛型特化的函数签名特化:Swift.MutableCollection在Swift和Swift.UnsafeMutableBufferPointer:Swift中的Swift.RandomAccessCollection> of Swift._siftDown(inout A,index:A.Index,subRange:Swift.Range,by:inout(A.Iterator.Element,A.Iterator.Element) - > Swift.Bool) - >()在OrderCoordinator.o函数签名中使用Swift.UnsafeMutableBufferPointer进行泛型特化:WSift中的Swift.MutableCollection和Swift.UnsafeMutableBufferPointer:Swift中的Swift.RandomAccessCollection> Swift._heapSort(inout A,subRange: Swift.Range,by:inout(A.Iterator.Element,A.Iterator.Element) - > Swift.Bool) - >()在OrderCoordinator.o函数签名中使用Swift.UnsafeMutableBufferPointer进行泛型特化:Swift.Mu swift和Swift.UnsafeMutableBufferPointer中的tableCollection:Swift中的Swift.RandomAccessCollection> Swift._partition(inout A,subRange:Swift.Range,by:inout(A.Iterator.Element,A.Iterator.Element) - > Swift.Bool) - > OrderCoordinator.o中的A.Index:未找到架构armv7 clang的符号:错误:链接器命令失败,退出代码为1(使用-v查看调用)
通过在以下函数中注释数组排序代码,我能够摆脱错误:
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, …
Run Code Online (Sandbox Code Playgroud) 根据Apple文档initialize()
方法,在收到第一条消息之前初始化类.
有人可以解释为什么initialize()在Release构建配置中不起作用吗?
例如:
class Test: NSObject {
override class func initialize() {
print("initialize")
}
class func test() {
print("test")
}
}
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
Test.test()
}
}
Run Code Online (Sandbox Code Playgroud)
调试配置中的输出:
initialize
test
Run Code Online (Sandbox Code Playgroud)
发布配置中的输出:
test
Run Code Online (Sandbox Code Playgroud)