此代码在Debug
模式(Xcode8.0)中构建良好:
private func rebuildMyClass3sForMyClassCache() {
someWorker.fetchClass1Categories { (categories: [MyClass2]) in
self.representedMyClass3sForMyClass1 = categories
.flatMap { $0.class1s.sorted(by: { (a: MyClass1, b: MyClass1) -> Bool in
return (a.priorityWithinCategory ?? 0) < (b.priorityWithinCategory ?? 0)
})
}
// we want to show MyClass1 sections only for MyClass1s that actually contain MyClass3s
.filter { $0.belongingMyClass3s.count > 0 }
}
但在构建Release
时会出现链接器错误:
Showing Recent Issues "Swift.UnsafeMutableBufferPointer.(subscript.materializeForSet : (Swift.Int) -> A).(closure #1)", referenced from:
function signature specialization <Arg[2] = Exploded> of generic specialization
<Swift.UnsafeMutableBufferPointer<MessagesExtension.MyClass1> with
Swift.UnsafeMutableBufferPointer<MessagesExtension.MyClass1> :
Swift.MutableCollection in Swift and
Swift.UnsafeMutableBufferPointer<MessagesExtension.MyClass1> :
Swift.RandomAccessCollection in Swift> of Swift._siftDown <A where A:
Swift.MutableCollection, A: Swift.RandomAccessCollection> (inout A, index : A.Index, subRange : Swift.Range<A.Index>, by : inout (A.Iterator.Element, A.Iterator.Element) -> Swift.Bool) -> () in ManageMyClass3sInteractor.o
this Question建议禁用编译器优化 在我看来,不是发布的选项。
答案 0 :(得分:0)
原来是一个Xcode 8.0错误。
更新到Xcode 8.1解决了这个问题。