Error '_BSMachError: port 1607; (os/kern) invalid capability (0x14) "Unable to insert COPY_SEND" in Cordova app on iOS 10
Asked Answered
T

11

78

Everything works fine till I build my cordova application with Xcode 7.3.0 but it started crashing only on iOS 10 devices after building the same application with Xcode 8 whenever i'm changing the orientation from Portrait to Landscape where as it still working fine on iOS 9.3.1. In debugger i'm getting following logs:

2016-09-24 18:14:41.212470 MyApp[2542:1028606] [Common] _BSMachError: port 1607; (os/kern) invalid capability (0x14) "Unable to insert COPY_SEND"
2016-09-24 18:14:41.613460 MyApp[2542:1028606] [Common] _BSMachError: port 1607; (os/kern) invalid name (0xf) "Unable to insert COPY_SEND"
2016-09-24 18:14:41.613947 MyApp[2542:1028606] [Common] _BSMachError: port 1607; (os/kern) invalid name (0xf) "Unable to insert COPY_SEND"
2016-09-24 18:14:41.614469 MyApp[2542:1028606] [Common] _BSMachError: port 1607; (os/kern) invalid name (0xf) "Unable to deallocate send right"
Message from debugger: Terminated due to memory issue

Below is the stack trace

warning: could not load any Objective-C class information from the dyld shared cache. This will significantly reduce the quality of type information available.

* thread #1: tid = 0xfc80c, 0x00000001000cff00 MyApp`-[MainViewController didReceiveMemoryWarning](self=0x0000000119e0da60, _cmd="didReceiveMemoryWarning") + 40 at MainViewController.m:59, stop reason = breakpoint 7.1

  * frame #0: 0x00000001000cff00 MyApp`-[MainViewController didReceiveMemoryWarning](self=0x0000000119e0da60, _cmd="didReceiveMemoryWarning") + 40 at MainViewController.m:59
    frame #1: 0x0000000192e29964 UIKit`+[UIViewController _traverseViewControllerHierarchyWithDelayedRelease:] + 432
    frame #2: 0x0000000192d5a0f4 UIKit`-[UIApplication _performMemoryWarning] + 232
    frame #3: 0x0000000192d5a294 UIKit`-[UIApplication _receivedMemoryNotification] + 140
    frame #4: 0x0000000100a7d21c libdispatch.dylib`_dispatch_client_callout + 16
    frame #5: 0x0000000100a893a8 libdispatch.dylib`_dispatch_continuation_pop + 708
    frame #6: 0x0000000100a97fa8 libdispatch.dylib`_dispatch_source_latch_and_call + 204
    frame #7: 0x0000000100a7f304 libdispatch.dylib`_dispatch_source_invoke + 836
    frame #8: 0x0000000100a82060 libdispatch.dylib`_dispatch_main_queue_callback_4CF + 652
    frame #9: 0x000000018cc29f2c CoreFoundation`__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
    frame #10: 0x000000018cc27b18 CoreFoundation`__CFRunLoopRun + 1660
    frame #11: 0x000000018cb56048 CoreFoundation`CFRunLoopRunSpecific + 444
    frame #12: 0x000000018e5d9198 GraphicsServices`GSEventRunModal + 180
    frame #13: 0x0000000192b2f818 UIKit`-[UIApplication _run] + 684
    frame #14: 0x0000000192b2a550 UIKit`UIApplicationMain + 208
    frame #15: 0x00000001000c7ecc MyApp`main(argc=1, argv=0x000000016fd3fab8) + 76 at main.m:32
    frame #16: 0x000000018bb385b8 libdyld.dylib`start + 4

I'm running

  • Xcode 8
  • Cordova 6.3.0 (iOS 4.1.0)
  • iOS 10 iPhone 6

Please help.

Thoroughgoing answered 24/9, 2016 at 13:19 Comment(3)
I found the root cause of the problem ...its the new svg file (size > 1 mb) added to the project creating the problem in landscape mode. I'm not sure whether problem lies in iOS Web View component or svg file because for smaller svg its working perfectly fine.Thoroughgoing
The root cause (according to the stack trace you pasted) is that your application has been using too much memory, and did not free enough memory when requested. This also seems coherent with your comment regarding the .svg file size. You should implement the didReceiveMemoryWarning selector in your app delegate to free unused objects.Adventurer
I got this error when calling popViewController() inside of the handler for an AlertController. Dispatching the code that calls popViewController() asynchronously to the main thread solved it since the alert controller is cleaned up before the pop is called. I'm adding this comment since others who get this error might have it caused by something other than what is causing it for you.Hebraist
S
77

I was getting the "invalid capability (0x14) "Unable to insert COPY_SEND" message in the debugger which would prevent the app from launching for about 10 seconds.

I had breakpoints set in files that I had since removed from the project but were still showing up in the Breakpoint navigator (file names in red).

I removed ALL breakpoints and haven't seen the error message since.

Squireen answered 6/3, 2017 at 10:55 Comment(7)
I know it sounds weird but this actually did the trick. Just deleted all the breakpoints and BAM! everything works all of a sudden!Lumbricoid
Works for me too. Watch out the code, if you get 0x14, this one is your solution.Essex
Works for me :)Oestriol
Was getting that error: [Common] _BSMachError: port c203; (os/kern) invalid capability (0x14) "Unable to insert COPY_SEND". Removing breakpoints fixed it.Vadavaden
This is a devious head-smackingly-obtuse solution but it worked for me! please fix this apple!Fleischer
#1666244Schott
initially changing orientation worked for me , second time didn't and removing all BPs helped , that's Apple for you.Cattier
P
55

I ran into the same problem during iOS10.0 beta phases, and it seems to still be present in Xcode v11.

There are actually 2 separate errors :


1. First of all, as Avaan commented, you have to set all the privacy usage in the info.plist. I believe it is the cause of your crash.

Since iOS10.0, it is mandatory to explicitly tell the user what features of the phone you will use, and for what reasons.

Project Info


2. Regarding the error :

BSMachError: port 1607; (os/kern) invalid capability (0x14) "Unable to insert COPY_SEND"

I resolved the error with this little workaround :

  1. Go in Project Settings/General -> Deployment info, check all orientations.

General settings

  1. Build and run, the interface should rotate according to the device orientation.
  2. Undo what you just did (uncheck orientations you don't need). Build and run again, the errors should not appear anymore.

I hope this helped

Purplish answered 4/10, 2016 at 9:45 Comment(7)
wow...i didn't expect this to work but it did. +1 EDIT: XCode v8.1Twentieth
+1 Great the second step fixed my error. Initially all orientation was checked, I then kept only Portrait and after that built and run and then checked all again. I am using WKWebViewBaudin
Didn't work for me :(. Still getting crash. Xcode 11.1. Running on iOS 11.4.1 hardware. The problem is arising when app launches and I rotate before it finishes launching. It's not happening when running/debugging under Xcode, only when standalone. I'm guessing this is related to the “Unable to insert COPY_SEND” because when I do run under Xcode, I see that message.Hypostasis
I'm on Xcode 9.4.1. I've tried all of these and I still get this weird error. I'm not getting a crash, I just can post any media items to my chat table. Any other suggestions?Backcross
this is ridiculous and senseless of apple.Cattier
This is a stunning little example of the myriad of ways that an app project can go astray. I liken this to you working on an engine in a garage and the engine won't fire up until you go and replace the light bulb over the workbench. But KUDOS for the tip!! Worked for me.Classical
That orientation workaround for the COPY_SEND bug is just bizarre. But it worked for me, four years later on iOS 13, from Xcode 11.5.Wickerwork
P
6

I received precisely this error carrying out reset of Core Data but none of the above solutions worked or was relevant in my case. Turned out to be result of code taking place inside action of UIAlert which needed to be pushed into main thread. Solution found through here - Error _BSMachError: (os/kern) invalid capability (20) after receiving remote notification on CloudKit record addition - and updated below for Swift 4:

alert.addAction(UIAlertAction(title: "Reset Now", style: UIAlertAction.Style.default, handler: { action in
            DispatchQueue.main.async {
                // Core Data reset code goes here...
            }
}))
Prate answered 25/1, 2019 at 18:56 Comment(0)
P
5

For me the cause was [myTextField becomeFirstResponder]; placed after the initial viewWillAppear thread ended.

Petulia answered 2/5, 2018 at 21:25 Comment(0)
I
2

Xcode 11.5 introduced a new invalid capability: [textField resignFirstResponder] with the incomprehensible addition "Unable to insert COPY_SEND"

On a iPad with iOS 9.3.6:

2020-05-23 20:35:01.576 _BSMachError: (os/kern) invalid capability (20)
2020-05-23 20:35:01.580 _BSMachError: (os/kern) invalid name (15)

On a iPad with iPadOS 13.5:

2020-05-23 20:38:49 [Common] _BSMachError: port 12f0f; (os/kern) invalid capability (0x14) "Unable to insert COPY_SEND"

On a iPhone with iOS 13.5:

2020-05-23 20:43:34 [Common] _BSMachError: port d503; (os/kern) invalid capability (0x14) "Unable to insert COPY_SEND"

[textField resignFirstResponder] cannot be used anymore. See How to resign first responder from text field when user tap elsewhere? for alternatives.

Involuntary answered 24/5, 2020 at 2:38 Comment(2)
Have the same problem when I want to call the textField.becomeFirstResponder with Xcode 11.5. Is this a bug or do we really need to choose an alternative?Animator
You will have to use an alternative. See the link I posted in the last line of my response.Involuntary
E
1

Turns out - the app will crash if you call EventKit, ContactsKit, Microphone, Camera, etc that require permissions without Info.plist keys like
Privacy - Location When In Use Usage Description
Privacy - Media Library Usage Description

I got this answer from https://forums.developer.apple.com/thread/48959 thread

also, check whether you forgot to disable zombies.

Emotive answered 24/9, 2016 at 14:23 Comment(2)
Hi NSSam, I tried all the options but didn't resolve the issue. Crash happening only on the real devices, on simulators its working fine but spitting huge set of warnings.Thoroughgoing
try adding NSPhotoLibraryUsageDescription.Dowry
P
1

I had a similar problem (check out my question on SO) and found out that my UI had created another instance of itself, presenting both at the same time.

If you have not found a solution to your problem yet I advice you to use the Debug View Hierarchy-tool... maybe you have got the same kind of problem as I had.

Good luck!

Poetaster answered 30/9, 2016 at 11:56 Comment(0)
P
1

I got this when adding a Info.plist key without a matching string. In my instance I added NSLocationAlwaysAndWhenInUseUsageDescription without a description. Accessing the permission dialog cause this error to occur. Adding a string value resolved the issue. iOs11.

Porshaport answered 17/8, 2017 at 2:46 Comment(1)
Turns out this was the problem for me. Weird, huh? Thanks!Beam
I
1

I was getting this error, tried every solution in this thread, and nothing worked. I had a seemingly unrelated UIColor (color out of range) error that I fixed and this COPY_SEND issue went away, too.

The specific UIColor error was UIColorBreakForOutOfRangeColorComponents.

Ibnrushd answered 28/3, 2018 at 18:30 Comment(1)
Worked for me. Thanks.Oleaceous
T
1

I suddenly had this error using the iPhone 11 pro simulator while it was working fine everywhere else (other simulators and actual devices).

The solution for me was to reset the simulator by choosing Hardware > Erase All Content and Settings...

Hope it can help some others in the same case.

Terti answered 2/3, 2020 at 14:24 Comment(0)
A
0

For me was the translations on my plist. Double check that if your plist is localized has the proper privacy texts translated.

Took me hours until found it... I Was getting a SFSafariView layout issue all the time.

Arana answered 12/3, 2018 at 11:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.