我在iOS上面临org.apache.cordova.camera r0.3.5的问题。 r0.3.4对我来说一切正常。我试图拍照时应用程序崩溃了。请查看导致问题的行。
- (void)takePicture:(CDVInvokedUrlCommand*)command
{
....
[weakSelf.viewController presentViewController:cameraPicker animated:YES completion:^
Thread 3: EXC_BAD_ACCESS
}
2015-02-27 09:28:50.332 App[1455:860f] bool
_WebTryThreadLock(bool), 0x1ee707a0: Tried to obtain the web lock from
a thread other than the main thread or the web thread. This may be a
result of calling to UIKit from a secondary thread. Crashing now...
1 0x39e643b7 WebThreadLock
2 0x35fc5b4f <redacted>
3 0x35e01691 <redacted>
4 0x36042619 <redacted>
5 0x35e549b9 <redacted>
6 0x35e52fe7 <redacted>
7 0x21d93 __25-[CDVCamera takePicture:]_block_invoke
8 0x3bfd311f <redacted>
9 0x3bfe1259 <redacted>
10 0x3bfe13b9 <redacted>
11 0x3c007a11 <redacted>
12 0x3c0078a4 start_wqthread
谢谢,
答案 0 :(得分:1)
我遇到了同样的问题。我调试了一下,问题出在CDVCamera.m文件中。在第170行,您有以下代码
[weakSelf.viewController presentViewController:cameraPicker animated:YES completion:^{
weakSelf.hasPendingOperation = NO;
}];
应该在主线程中调度整个调用。我认为这在以后的版本中已得到修复,但如果您想要快速修复,请执行以下操作
dispatch_async(dispatch_get_main_queue(), ^{
[weakSelf.viewController presentViewController:cameraPicker animated:YES completion:^{
weakSelf.hasPendingOperation = NO;
}];
});
所以简而言之,您可以选择新版本,即r0.3.6,或者您可以自行更改。万一你不知道你会在&#34; org.apache.cordova.camera&#34;下的插件文件夹中找到这个文件。夹。干杯!!