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

removeOnBreadcrumbBlock not working from swift #1203

Closed
hovox opened this issue Oct 6, 2021 · 2 comments
Closed

removeOnBreadcrumbBlock not working from swift #1203

hovox opened this issue Oct 6, 2021 · 2 comments
Labels
bug Confirmed bug released This feature/bug fix has been released

Comments

@hovox
Copy link

hovox commented Oct 6, 2021

Hi Bugsnag team,

We have tried to use removeOnBreadcrumbBlock from swift and find out that is not deleting the block.

Here is the code examples which we have tried:

// passing as function like mentioned in the documentation
func cb(breadcrumb: BugsnagBreadcrumb) -> Bool { /* ... */ }
Bugsnag.addOnBreadcrumb(block: cb)
// ...
Bugsnag.removeOnBreadcrumb(block: cb)

// passing as @convention(block
let bl:@convention(block) (_ breadcrumb: BugsnagBreadcrumb) -> Bool =
Bugsnag.addOnBreadcrumb(block: cb)
// ...
Bugsnag.removeOnBreadcrumb(block: cb)

and some other variations , we have tried to remove copy call in the addOnBreadcrumb and nothing helped.

Then in the new project we have tried to reproduce the issue, we have found out that when we are changing addOnBreadcrumb/removeOnBreadcrumb to + (void)removeOnBreadcrumbBlock:(id)block,+ (void)addOnBreadcrumbBlock:(id)block (type is id) it started working. Then we have did a workaround by declaring an extension on the Bugsnag class:

 + (void)addOnBreadcrumbAnyTypeBlock:(id)block {
     [self addOnBreadcrumbBlock:block];
 }

 + (void)removeOnBreadcrumbAnyTypeBlock:(id)block {
     [self removeOnBreadcrumbBlock:block];
 }

 @end

when we call `addOnBreadcrumbAnyTypeBlock/removeOnBreadcrumbAnyTypeBlock from swift it correctly adds/removes.

@luke-belton
Copy link

Hi @hovox - thanks for raising this. We've managed to reproduce this and we're going to look into it further. We'll keep you updated on this thread!

@luke-belton luke-belton added bug Confirmed bug needs discussion Requires internal analysis/discussion labels Oct 7, 2021
@yousif-bugsnag
Copy link
Contributor

This is now fixed in v6.15.0 🎉

@yousif-bugsnag yousif-bugsnag added released This feature/bug fix has been released and removed needs discussion Requires internal analysis/discussion labels Dec 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bug released This feature/bug fix has been released
Projects
None yet
Development

No branches or pull requests

3 participants