我正在开发一个应用程序,我需要在 ios 应用程序中扫描几个条形码。我被要求在我的 monotouch 应用程序中使用 RedLaser 库。
经过一些调整,我能够在我的机器上编译、构建和运行应用程序。
但是,一旦我从主屏幕单击扫描按钮,应用程序就会崩溃。我在 MonoDevelop 的应用程序输出面板上看不到任何异常、错误或警告。我也找不到任何日志。该应用程序正在 iOSSimulator 上运行。
当 OverrlayController 尝试加载 ParentPicker 时,就会出现此问题。即使只是检查它的值也会使应用程序崩溃。
我已经在崩溃的地方放置了一个代码示例。我发现这里的二维码有问题,所以我禁用了二维码扫描。但仍然是同样的崩溃。我在用
Monotouch 6.0、MonoDevelop 3.0.5、RedLaser 3.4.0
任何帮助将不胜感激。
public partial class RLSampleViewController : UIViewController
{
public RLSampleViewController (IntPtr handle) : base (handle) { }
partial void scanPressed (MonoTouch.UIKit.UIBarButtonItem sender)
{
//THIS IS THE LINE WHERE THE APP IS JUST CRASHING
if (overlayController.ParentPicker == null)
{
BarcodePickerController picker = new BarcodePickerController ();
// setup picker
picker.Overlay = overlayController;
picker.Delegate = new BarcodePickerDelegate (this);
// Initialize with portrait mode as default
picker.Orientation = UIImageOrientation.Up;
// The active scanning region size is set in OverlayController.m
}
// The rest of the code was ignored
我已经更新了问题以包含崩溃日志(感谢 Rolf B. 指出我在哪里可以找到它)。但是,它对我来说仍然没有任何意义,因为我不熟悉 Objective-C。
> Process: RedLaserSample [10999]
> Path: /Users/USER/Library/Application Support/iPhone
> Simulator/*/RedLaserSample.app/RedLaserSample
> Identifier: RedLaserSample
> Version: ???
> Code Type: X86 (Native)
> Parent Process: launchd [243]
> User ID: 501
> Date/Time: 2013-01-08 16:58:35.532 +1100
> OS Version: Mac OS X 10.8.2 (12C60)
> Report Version: 10
> Crashed Thread: 0 Dispatch queue: com.apple.main-thread
> Exception Type: EXC_BAD_ACCESS (SIGSEGV)
> Exception Codes: KERN_PROTECTION_FAILURE at 0x00000000bf7ffffc
> VM Regions Near 0xbf7ffffc:
> Stack 00000000b056d000-00000000b057d000 [ 64K] rw-/rwx SM=COW
> --> Stack 00000000bc000000-00000000bf800000 [ 56.0M] ---/rwx SM=NUL
> Stack 00000000bf800000-00000000c0000000 [ 8192K] rw-/rwx SM=COW
> Application Specific Information:
> iPhone Simulator 358.4, iPhone OS 6.0 (iPhone/10A403)
> Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
> 0 CoreFoundation 0x0405f6cd typeStringHash + 13
> 1 CoreFoundation 0x03fffdb0 __CFDictionaryHashKey + 32
> 2 CoreFoundation 0x03fe53e2 CFBasicHashFindBucket + 1426
> 3 CoreFoundation 0x03fe4e2d CFDictionaryGetValue + 109
> 4 CoreFoundation 0x0405e0ea +[NSMethodSignature signatureWithObjCTypes:] + 250
> 5 CoreFoundation 0x040fb5c3 -[NSObject(NSObject) methodSignatureForSelector:] + 83
> 6 RedLaserSample 0x0027a752 monotouch_trampoline + 82
> 7 ??? 0x0c7e9010 0 + 209621008
> 8 ??? 0x12c68efc 0 + 315002620
> 9 ??? 0x12c68fd4 0 + 315002836
> 10 RedLaserSample 0x00077112 mono_jit_runtime_invoke + 722
> 11 RedLaserSample 0x001d8bae mono_runtime_invoke + 126
> 12 RedLaserSample 0x0027b568 monotouch_trampoline + 3688
> 13 ??? 0x0c7e9010 0 + 209621008
> 14 ??? 0x12c68efc 0 + 315002620
> 15 ??? 0x12c68fd4 0 + 315002836