【发布时间】:2017-02-02 06:11:34
【问题描述】:
在我使用 Xcode 7.3.0 构建我的 Cordova 应用程序之前一切正常,但在我使用 Xcode 8 构建相同的应用程序后,它只在 iOS 10 设备上开始崩溃,只要我从 Portrait 更改方向到 Landscape,因为它在 iOS 9.3.1 上仍然可以正常工作。 在调试器中,我得到以下日志:
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
下面是堆栈跟踪
警告:无法从 dyld 共享缓存加载任何 Objective-C 类信息。这将显着降低可用类型信息的质量。
* 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
我在跑步
- Xcode 8
- Cordova 6.3.0 (iOS 4.1.0)
- iOS 10 iPhone 6
请帮忙。
【问题讨论】:
-
我找到了问题的根本原因......它添加到项目中的新 svg 文件(大小 > 1 mb)在横向模式下创建了问题。我不确定问题出在 iOS Web View 组件还是 svg 文件上,因为对于较小的 svg,它工作得非常好。
-
根本原因(根据您粘贴的堆栈跟踪)是您的应用程序使用了太多内存,并且在请求时没有释放足够的内存。这似乎也与您对
.svg文件大小的评论一致。您应该在您的应用委托中实现didReceiveMemoryWarning选择器以释放未使用的对象。 -
在 AlertController 的处理程序内调用 popViewController() 时出现此错误。将调用 popViewController() 的代码异步调度到主线程解决了这个问题,因为在调用 pop 之前清理了警报控制器。我添加此评论是因为收到此错误的其他人可能是由其他原因引起的,而不是为您造成的。
标签: objective-c cordova ios10 xcode8