23

When I receive a remote notification on a record addition (didReceiveRemoteNotification called), I get the following error message:

_BSMachError: (os/kern) invalid capability (20)

I've already tried to find out more about this in forums and via Google but I could not find any helpful advice that applies to my situation.

What does the error message mean? What can I do about it?

John
  • 8,468
  • 5
  • 36
  • 61
  • 6
    Xcode 7 I guess? Well, happened to me without any remote notifications. – Cœur Aug 19 '15 at 12:00
  • 1
    From this post it seems to be CoreSpotlight: http://blog.couldhll.com/2015/08/18/ios9-beta5-extension下调用corespotlight失败/, and here is another stack overflow question about it: http://stackoverflow.com/questions/32341851/bsmacherror-xcode-7-beta – fearmint Sep 21 '15 at 16:30

4 Answers4

13

I just experienced this error. I was in a UIAlert Action block; when the block exited the error occurred (BTW the parent UIAlertViewController was created in a dispatch_async block so was I guess off main thread.

Anyway, I wrapped the action code itself in

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{

       [self handleActionForElement:thisType];



    });

and error went away. Your mileage may vary!

Jose Ricardo Bustos M.
  • 8,016
  • 6
  • 40
  • 62
davidey
  • 131
  • 1
  • 3
1

For Swift 5, I ended up with:

func alertAction() {
  DispatchQueue.main.async {
     //perform code
  }
}
cwgso
  • 401
  • 3
  • 9
0

Thank you very much, I had the same issue on swift

So I've resolved it by putting code in main thread

func alertAction() {
  dispatch_async(dispatch_get_main_queue()) {
    //perform code
  }
}
Svitlana
  • 2,938
  • 1
  • 29
  • 38
0

Had same issue. I was trying to present a custom view on top of a presented view controller of third party framework.

Resolved by moving the presentation logic to my view controller

Sunil
  • 71
  • 1
  • 3