Error _BSMachError: (os/kern) invalid capability (20) after receiving remote notification on CloudKit record addition Error _BSMachError: (os/kern) invalid capability (20) after receiving remote notification on CloudKit record addition ios ios

Error _BSMachError: (os/kern) invalid capability (20) after receiving remote notification on CloudKit record addition


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!


For Swift 5, I ended up with:

func alertAction() {  DispatchQueue.main.async {     //perform code  }}


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  }}