Hi,
After migrating to Swift 3 using XCode 8.3.2 and Dropbox SDK 3.0.9 (Objective-C version) I am getting the mentioned error in 1 of the files. Further investigation shows the error is caused by this piece of code:
let listFolderResponseHandler : DBRpcResponseBlock = { response, routeError, networkError in
if let listFolderResult = response {
completionHandler(DropboxFolderMetadata(withPath: folderPath, listFolderResult: listFolderResult), nil, nil)
} else if let error = routeError {
completionHandler(nil, error, nil)
} else if let netError = networkError {
completionHandler(nil, nil, netError)
}
}
Replacing that line with this:
let listFolderResponseHandler: DBRpcResponseBlock? = nil
Still generates the error. BUT, commenting any of those out, gets rid of the error.
This is the context where that code exists:
import Foundation
import ObjectiveDropboxOfficial
struct DropboxHelper {
//Other functions
static func list(folder folderPath: String, cursor folderCursor: String?, completionHandler: @escaping (DropboxFolderMetadata?, DBFILESListFolderError?, DBRequestError?) -> Void) {
guard let client = DBClientsManager.authorizedClient() else { return }
let listFolderResponseHandler : DBRpcResponseBlock = { response, routeError, networkError in
if let listFolderResult = response {
completionHandler(DropboxFolderMetadata(withPath: folderPath, listFolderResult: listFolderResult), nil, nil)
} else if let error = routeError {
completionHandler(nil, error, nil)
} else if let netError = networkError {
completionHandler(nil, nil, netError)
}
}
//additional code commented right now
}
...
}
Looking further in the error log I get this message as the operation that was been executed when the error occured:
While emitting SIL for 'list' at <path>/Dropbox.swift:30:5
And stack dump:
0 swift 0x00000001094154f7 PrintStackTraceSignalHandler(void*) + 39
1 swift 0x00000001094149a6 SignalHandler(int) + 646
2 libsystem_platform.dylib 0x00007fffca086b3a _sigtramp + 26
3 libsystem_platform.dylib 0x000000010e9c2a00 _sigtramp + 1150533344
4 swift 0x000000010726627e swift::NominalTypeDecl::hasFixedLayout() const + 14
5 swift 0x0000000106e67172 (anonymous namespace)::LowerType::visitAnyStructType(swift::CanType, swift::StructDecl*) + 50
6 swift 0x0000000106e6677c swift::Lowering::TypeConverter::getTypeLoweringForUncachedLoweredType(swift::Lowering::TypeConverter::TypeKey) + 76
7 swift 0x0000000106e65fb8 swift::Lowering::TypeConverter::getTypeLowering(swift::Lowering::AbstractionPattern, swift::Type, unsigned int) + 2328
8 swift 0x0000000106a6303d swift::Lowering::SILGenFunction::emitLocalVariableWithCleanup(swift::VarDecl*, bool, unsigned int) + 189
9 swift 0x0000000106a62402 swift::Lowering::SILGenFunction::emitInitializationForVarDecl(swift::VarDecl*) + 338
10 swift 0x0000000106a64673 swift::Lowering::SILGenFunction::emitPatternBinding(swift::PatternBindingDecl*, unsigned int) + 83
11 swift 0x0000000106ad3ee8 swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 14712
12 swift 0x0000000106a93509 swift::Lowering::SILGenFunction::emitFunction(swift::FuncDecl*) + 409
13 swift 0x0000000106a1489b swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*)::$_1::operator()(swift::SILFunction*) const + 1867
14 swift 0x0000000106a138a2 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 642
15 swift 0x0000000106ad8efb (anonymous namespace)::SILGenType::emitType() + 971
16 swift 0x0000000106ad8acd swift::Lowering::SILGenModule::visitNominalTypeDecl(swift::NominalTypeDecl*) + 29
17 swift 0x0000000106a20ecb swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*, unsigned int) + 1483
18 swift 0x0000000106a22aa9 swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*, llvm::Optional<unsigned int>, bool, bool) + 1593
19 swift 0x0000000106233604 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 42516
20 swift 0x00000001061e2d6c main + 9052
21 libdyld.dylib 0x00007fffc9e77235 start + 1
22 libdyld.dylib 0x00000000000000c1 start + 907579021
Stack dump:
Any idea what might be the cause of this error?