-
Notifications
You must be signed in to change notification settings - Fork 369
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
Support iOS 15 SDK #398
Comments
They seem to have abandoned this library so I don't know if this issue will be resolved any time soon. Though someone may already have forked the library and made the changes |
So, new API changes have come with iOS 15 into the CoreBluetooth framework, and those causes the library to fail the compilation. The changes are related to nullability: iOS 14.XCBService
unowned(unsafe) var peripheral: CBPeripheral { get }
CBCharacteristic
unowned(unsafe) var service: CBService { get }
CBDescriptor
unowned(unsafe) var characteristic: CBCharacteristic { get } iOS 15.XCBService
weak var peripheral: CBPeripheral? { get }
CBCharacteristic
weak var service: CBService? { get }
CBDescriptor
weak var characteristic: CBCharacteristic? { get } The main affected classes are: Source/CentralManagerRestoredState.swift public var services: [Service] {
let objects = restoredStateData[CBCentralManagerRestoredStateScanServicesKey] as? [AnyObject]
guard let arrayOfAnyObjects = objects else { return [] }
#if swift(>=4.1)
let cbServices = arrayOfAnyObjects.compactMap { $0 as? CBService }
#else
let cbServices = arrayOfAnyObjects.flatMap { $0 as? CBService }
#endif
return cbServices.map { Service(peripheral: centralManager.retrievePeripheral(for: $0.peripheral),
service: $0) }
} This one could be solved by filtering the ones that are not nil: public var services: [Service] {
let objects = restoredStateData[CBCentralManagerRestoredStateScanServicesKey] as? [AnyObject]
guard let arrayOfAnyObjects = objects else { return [] }
#if swift(>=4.1)
let cbServices = arrayOfAnyObjects.compactMap { $0 as? CBService }
#else
let cbServices = arrayOfAnyObjects.flatMap { $0 as? CBService }
#endif
return cbServices
.filter { $0.peripheral != nil }
.map {
Service(peripheral: centralManager.retrievePeripheral(for: $0.peripheral!), service: $0)
}
} Source/Characteristic.swift convenience init(characteristic: CBCharacteristic, peripheral: Peripheral) {
let service = Service(peripheral: peripheral, service: characteristic.service)
self.init(characteristic: characteristic, service: service)
} Source/Descriptor.swift convenience init(descriptor: CBDescriptor, peripheral: Peripheral) {
let service = Service(peripheral: peripheral, service: descriptor.characteristic.service)
let characteristic = Characteristic(characteristic: descriptor.characteristic, service: service)
self.init(descriptor: descriptor, characteristic: characteristic)
} These last two might be a little bit trickier since we require not nullable parameters in What do you think about that @mpiechocki? |
Adding @minixT to please the issue to shed us some light here. |
There are some changes to the CoreBluetooth API. Specially to the memory managment Details are described here Polidea#398
@minixT or @mpiechocki are you able to have a look at the PR? |
@chamira-at I don't know if I will have time to look at it thoroughly, sorry. I think it's not clear if we will be able to maintain this library whatsoever, unfortunately :( |
@mpiechocki Understandable that you guys will not be able to promise anything. Could this be considered grounds to move the project to the @abandonware organisation, so that the community may more effectively be able to solve the issues? iOS 15 is probably right around the corner (read: 7-14 days), so even a start of defaulting to moving it to abandonware would be helpful to a lot of people. I highly appreciate you guys' work on this! It's been amazing using the project, and I'd hate to see it die, hence the suggestion. |
What’s the workaround? How can we fix this just for our code to compile? |
There are forks that have already applied the necessary changes for you to use in the meantime. You could fork from one of those and come back to the original if/when it's ever updated: Try this one |
@tylerjames I tried to update pod with 7.0.2 tag but couldn't install `
` I changed platform :ios, '10.0' to 11 ,12,13,14,15 but didn't work |
Hello @mpiechocki, have you guys considered what @DaBs suggested about moving the project to the community? It's been a while since iOS 15 came out, and it's pretty bad not to keep great projects like this up to date with blocker issues like this among other things. As he also mentions, I'd also thank a lot Polidea for what it did opening this great library to us. |
You need to make sure your other dependencies like RxSwift is also on 6.0+ you can use You might also need to update your other dependencies that relies on RxSwift (RxSwiftExt, RxCocoa, etc..) to the latest version. |
so bad |
@mpiechocki any updates? |
Any updates ? |
* Fixed deprecated methods by replacing the with new method signatures (fixed warning) * Fixed warning `ManagerType` deprecated protocol class type * Support for iOS 15 There are some changes to the CoreBluetooth API. Specially to the memory managment Details are described here Polidea#398 * Revert "Fixed deprecated methods by replacing the with new method signatures (fixed warning)" This reverts commit e02bb01. * Replace unnecessary chaining sequence of .map with compactMap * Change force unrwapping in XCTest Classes to XCTUnwrap --------- Co-authored-by: Chamira Fernando <[email protected]>
Is your feature request related to a problem? Please describe.
Apps using
RxBluetoothKit
with iOS 15 SDK cannot be built.Describe the solution you'd like
Fix issues related to
CoreBluetooth
api changes (compiler complains about optionals that need to be unwrapped).Describe alternatives you've considered
None.
Additional context
None.
The text was updated successfully, but these errors were encountered: