【发布时间】:2015-10-03 21:40:52
【问题描述】:
我有一个 Objective C 函数声明为:
+ (BOOL)isScanningUnsupported:(NSError **)error;
如果它返回 true,我必须在从 (Swift) 调用它的函数中返回 nil。
所以我会这样打电话:
var isUnsupported = false
do { try isUnsupported = PPCoordinator.isScanningUnsupported()
} catch let error { throw error }
if isUnsupported {return nil }
但它告诉我:
无法将“()”类型的值分配给“Bool”类型的值
在Objective C中它被称为:
if ([PPCoordinator isScanningUnsupported:error]) {
return nil;
}
我该怎么办????
【问题讨论】:
标签: objective-c error-handling try-catch return-value swift2