Skip to content

Commit

Permalink
Add presenting alert on value updating error
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikołaj Piechocki committed Oct 23, 2020
1 parent d085486 commit 677de32
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ class PeripheralViewController: UIViewController {
let data = value.data(using: .utf8),
let characteristic = self.characteristic else { return }

let result = manager.updateValue(data, for: characteristic, onSubscribedCentrals: nil)
print("updating value: \(result)")
let updated = manager.updateValue(data, for: characteristic, onSubscribedCentrals: nil)
if !updated {
AlertPresenter.presentError(with: "Updating error", on: navigationController)
}
}

private func createService(uuidString: String) -> CBMutableService {
Expand Down

0 comments on commit 677de32

Please sign in to comment.