gpt4 book ai didi

c# - 一旦显示 BarcodePickerController,通过 MonoTouch 使用 RedLaser SDK 就会崩溃

转载 作者:太空狗 更新时间:2023-10-30 01:08:14 24 4
gpt4 key购买 nike

我正在使用 Chris Branson 的 RedLaser MonoTouch 绑定(bind)和示例: https://github.com/chrisbranson/RedLaserSample

首先,为了帮助那些也遇到此示例项目问题的人,我必须更新 makefile 以构建 RedLaser.dll MonoTouch 绑定(bind)和示例 MonoDevelop csproj 以获取实际的应用程序编译。

  • 生成文件
    Chris 提供的 makefile 解压缩了 RedLaser SDK 下载,但 RedLaser 更改了它们的命名约定,因此它不再有效。我简化了它,而不是要求用户手动将 libRedLaserSDK.a 文件放入构建目录:

    BTOUCH=/Developer/MonoTouch/usr/bin/btouch
    BUILDVER=build139
    VERSION=3.2.4
    BINDIR=./bin/

    all: $(BINDIR)RedLaser.dll

    $(BINDIR)libRedLaserSDK.a:
    @echo "You'll need to obtain a copy of RedLaserDevSDK-$(VERSION).zip from"
    @echo "http://redlaser.com/sdk/index.php"
    @echo Locate the libRedLaserSDK.a file and place within
    @echo $(BINDIR)
    @echo
    @open http://redlaser.com/sdk/index.php
    @exit 1

    $(BINDIR)RedLaser.dll: Makefile AssemblyInfo.cs RedLaser.cs enums.cs $(BINDIR)libRedLaserSDK.a
    $(BTOUCH) --out=$@ -e RedLaser.cs enums.cs AssemblyInfo.cs --link-with=$(BINDIR)libRedLaserSDK.a,libRedLaserSDK.a

    clean:
    -rm -rf $(BINDIR)*.dll

    包含 makefile 的目录还应包含文件 redlaser.csenums.csAssemblyInfo.cs(即与克里斯的)。

  • MonoDevelop 项目build设置
    我认为这停止工作的原因是 MonoDevelop 或 MonoTouch 中的错误以及它在包含引号时扩展“其他 mtouch 参数”的方式。 Chris 的原始论点如下所示:

    -cxx -gcc_flags="-framework SystemConfiguration -framework CFNetwork -framework CoreVideo -framework CoreMedia -framework AVFoundation -framework OpenGLES -framework Security -L${ProjectDir}/Lib -lRedLaserSDK -ObjC"  

    MonoDevelop 没有正确解析它,而是在每个由空格分隔的选项周围插入引号。查看构建输出(在“编译为 native 代码”下)显示这已扩展为:

    "/Users/tyson/Downloads/chrisbranson-RedLaserSample-1a5545f-1/RedLaserSample/Lib/RedLaser.dll" -debug -nolink -sdk "5.1" -targetver "5.1" --armv7 "-cxx" "-gcc_flags=\"-framework" "SystemConfiguration" "-framework" "CFNetwork" "-framework" "CoreVideo" "-framework" "CoreMedia" "-framework" "AVFoundation" "-framework" "OpenGLES" "-framework" "Security" "-L/Users/tyson/Downloads/chrisbranson-RedLaserSample-1a5545f-1/RedLaserSample/Lib" "-lRedLaserSDK" "-ObjC\""  

    解决方案涉及在整个“gcc_flags”选项周围添加显式引号,手动转义内部引号。例如:

    "-cxx" "-gcc_flags=\"-framework SystemConfiguration -framework CFNetwork -framework CoreVideo -framework CoreMedia -framework AVFoundation -framework OpenGLES -framework Security -L${ProjectDir}/Lib -lRedLaserSDK -ObjC\""  

    这正确地扩展为:

    "/Users/tyson/Downloads/chrisbranson-RedLaserSample-1a5545f-1/RedLaserSample/Lib/RedLaser.dll" -debug -nolink -sdk "5.1" -targetver "5.1" --armv7 "-cxx" "-gcc_flags=\"-framework SystemConfiguration -framework CFNetwork -framework CoreVideo -framework CoreMedia -framework AVFoundation -framework OpenGLES -framework Security -L/Users/tyson/Downloads/chrisbranson-RedLaserSample-1a5545f-1/RedLaserSample/Lib -lRedLaserSDK -ObjC\""

好的,现在我已经编译好了,我尝试在我的手机上运行它。该应用程序加载正常,并通过 RedLaserSDK.CheckReadyStatus() 函数成功调用 RedLaser SDK。但是,一旦我按下扫描按钮(加载 BarcodePickerController),它就会崩溃,并在 RedLaser SDK 深处出现 native 异常:

terminate called throwing an exception
Native stacktrace:

0 RedLaserSample 0x0159d62d mono_handle_native_sigsegv + 244
1 RedLaserSample 0x015b6251 sigabrt_signal_handler + 112
2 libsystem_c.dylib 0x319b67ed _sigtramp + 48
3 libsystem_c.dylib 0x319ac20f pthread_kill + 54
4 libsystem_c.dylib 0x319a529f abort + 94
5 libc++abi.dylib 0x34fb1f6b abort_message + 46
6 libc++abi.dylib 0x34faf34d _ZL17default_terminatev + 24
7 libobjc.A.dylib 0x358e536f _objc_terminate + 170
8 libc++abi.dylib 0x34faf3c5 _ZL19safe_handler_callerPFvvE + 76
9 libc++abi.dylib 0x34faf451 _ZdlPv + 0
10 libc++abi.dylib 0x34fb079f __cxa_throw + 122
11 RedLaserSample 0x000404a9 _ZN5zxing6qrcode19FinderPatternFinder18selectBestPatternsEv + 172
12 RedLaserSample 0x000415e9 _ZN5zxing6qrcode19FinderPatternFinder4findERKNS_11DecodeHintsE + 512
13 RedLaserSample 0x0003a7f7 _ZN5zxing6qrcode8Detector6detectERKNS_11DecodeHintsE + 366
14 RedLaserSample 0x00046b97 _ZN5zxing6qrcode12QRCodeReader6decodeENS_3RefINS_12BinaryBitmapEEENS_11DecodeHintsE + 130
15 RedLaserSample 0x0004ec35 _ZN5zxing6Reader6decodeENS_3RefINS_12BinaryBitmapEEE + 240
16 RedLaserSample 0x00058455 -[FormatReader decode:] + 116
17 RedLaserSample 0x00013835 -[ZXingDecoder findCodesInBitmap:bytesPerRow:width:height:] + 656
18 RedLaserSample 0x0005f6af -[BarcodePhotoEngine zxingFindBarcodesInPixmap:] + 222
19 RedLaserSample 0x00055f25 __38-[BarcodeEngine findBarcodesInPixMap:]_block_invoke_059 + 76
20 libdispatch.dylib 0x34635c59 _dispatch_call_block_and_release + 12
21 libdispatch.dylib 0x34637d0f _dispatch_queue_drain + 274
22 libdispatch.dylib 0x34637b75 _dispatch_queue_invoke$VARIANT$mp + 40
23 libdispatch.dylib 0x346387e7 _dispatch_worker_thread2 + 210
24 libsystem_c.dylib 0x31967dfb _pthread_wqthread + 294
25 libsystem_c.dylib 0x31967cd0 start_wqthread + 8

=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================

运行非常相似的 RedLaser Xcode 示例项目(即不涉及 MonoTouch,所有 objective-c)工作正常。

此外,如果它有任何意义,禁用所有条形码扫描类型允许 BarcodePickerController 加载并显示相机 View 。显然,它从未检测到条形码。

最佳答案

您提到的崩溃是fixed in the bindings现在。

这与 QR 使用 C++ 异常和不正确的链接参数有关。

关于c# - 一旦显示 BarcodePickerController,通过 MonoTouch 使用 RedLaser SDK 就会崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10041124/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com