Skip to content

macOs <12 : Manager::new() : CBManager authorization objc error #335

Open
@oletf

Description

@oletf

Describe the bug

Problem occurring on call of Manager::new()

Developing an app on a 12.5.1 macOs where the problem doesn't occur.

I've been able to test on a 10.13.6 where I get a panic (foreign exception from rust's POV)
which I've been able to locate to an objc crash happening here :
the error being -[CBManager authorization]: unrecognized selector sent to instance 0x7f9be4601020

According to Apple objc SDK documentation the property went from an instance property to a class property idrk when exactly,
but

both seem to mention that the class property is available since macOS 10.15+ which I don't have access to for now to verify...


Since apparently the CBManager class is available since 10.13 I tried to change the code from :

// CBManager
pub fn manager_authorization() -> CBManagerAuthorization {
    unsafe { msg_send![class!(CBManager), authorization] }
}

to :

// CBManager
pub fn manager_authorization() -> CBManagerAuthorization {
    unsafe {
        let cbmanager: id = msg_send![class!(CBManager), new];
        msg_send![cbmanager, authorization]
    }
}

to get an instance of the class and try to get the legacy authorization property from it.

This change didn't break anything on 12.5, probably because it still gets the class property through the instance in the end.
But on 10.13 it didn't work better...the call to new worked, but the authorization didn't.

I discovered objc rust inter-workings with it on the fly, so I probably missed a thing...

Would anyone else be able to try it on a >=10.13, <12.0 macOs or happen to manage to figure out a better solution ?

Thanks forward

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions