を許可されていない私は谷にブロックNSErrorを渡していますし、このエラーを取得:値がnilになることはありません、比較は
Value of type 'NSError' can never be nil, comparison isn't allowed
これは、私は、エラーを返す必要があり、私のコンポーネントから要求されたコードですなめらか場合:
- (void)findPeripheralForDevice:(Device *)device completion:(void (^)(NSError *error, BOOL needsConfigure))completion;
は、これは私のコンポーネント・インタフェースである:
func findDeviceWithSerialNumber(serial: String, completion:(error: NSError, needsConfigure: Bool) -> Void)
これは私のコードがどのように見えるかです:
wirlessService.findDeviceWithSerialNumber(serial) { (error, needsConfigure) in
if error != nil { // here the error described above occurred
} else {
}
}
あなたの 'error'パラメータはオプションとして宣言されていません。 'nullable'アノテーションを追加してください。 //-developer.apple.com/swift/blog/?id=25 – Moritz
@EricD、まあまあですが、例えば ' - (void)findPeripheralForDevice:(Device *)デバイスの補完を呼び出すと、 ^)(NSError *エラー、BOOL needsConfigure))補完; '直接starnageでエラーが発生しない –