Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crash below iOS 11 when canSendWriteWithoutResponse called #241

Closed
Jenus opened this issue Mar 30, 2018 · 1 comment
Closed

crash below iOS 11 when canSendWriteWithoutResponse called #241

Jenus opened this issue Mar 30, 2018 · 1 comment
Assignees

Comments

@Jenus
Copy link

Jenus commented Mar 30, 2018

According to the apple docs:

The property of canSendWriteWithoutResponse is only supported iOS 11+, so we walk around this problem with the following code:

case .withoutResponse:
            if #available(iOS 11.0, *) {//bug fix for iOS 11
                return Observable<Characteristic>.deferred { [weak self] in
                    guard let strongSelf = self else { throw BluetoothError.destroyed }
                    return strongSelf.observeWriteWithoutResponseReadiness()
                        .map { _ in true }
                        .startWith(strongSelf.canSendWriteWithoutResponse)
                        .filter { $0 }
                        .take(1)
                        .flatMap { _ in
                            writeOperationPerformingAndListeningObservable(Observable.just(characteristic))
                    }
                    }.asSingle()
            } else {
                return writeOperationPerformingAndListeningObservable(Observable.just(characteristic))
                    .asSingle()
            }
@minixT
Copy link
Collaborator

minixT commented Apr 6, 2018

Fixed in #243

@minixT minixT closed this as completed Apr 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants