Binding XCode库的Monotouch绑定
我正在尝试绑定一个Xcode库,并且正在研究如何绑定。当我尝试访问任何事件或方法时,应用程序崩溃得很厉害 下面是我的描述Binding XCode库的Monotouch绑定,binding,xamarin.ios,Binding,Xamarin.ios,我正在尝试绑定一个Xcode库,并且正在研究如何绑定。当我尝试访问任何事件或方法时,应用程序崩溃得很厉害 下面是我的描述 using System; using System.Drawing; using MonoTouch.Foundation; using MonoTouch.ObjCRuntime; using MonoTouch.UIKit; namespace BardecodeBinding { [BaseType (typeof(NSObject),
using System;
using System.Drawing;
using MonoTouch.Foundation;
using MonoTouch.ObjCRuntime;
using MonoTouch.UIKit;
namespace BardecodeBinding
{
[BaseType (typeof(NSObject),
Delegates= new string [] {"WeakDelegate"},
Events = new Type [] { typeof(BardecodeDelegate) })]
interface Bardecode
{
[Export ("delegate", ArgumentSemantic.Assign)]
[NullAllowed]
NSObject WeakDelegate { get; set; }
[Wrap ("WeakDelegate")]
[NullAllowed]
BardecodeDelegate Delegate { get; set; }
[Export("ScanBarcodeFromViewFinder")]
void ScanBarcodeFromViewFinder();
}
[BaseType (typeof(NSObject))]
interface BardecodeDelegate
{
[Export ("didfinish:sender:notification:"), EventArgs("BardecodeDidFinish")]
void DidFinish (Bardecode sender, NSNotification notification);
}
}
我正试图从Softek绑定Bardecode库(http://www.bardecode.com/). 这是他们的头文件(部分)
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
#include "barcode.h"
#if TARGET_IPHONE_SIMULATOR
@interface Bardecode : NSObject <UINavigationControllerDelegate, UIImagePickerControllerDelegate>
#else
@interface Bardecode : NSObject <UINavigationControllerDelegate, UIImagePickerControllerDelegate, AVCaptureVideoDataOutputSampleBufferDelegate>
#endif
{
...
- (void) ScanBarcodeFromViewFinder;
...
}
@interface NSObject(NSWindowNotifications)
- (void)BardecodeDidFinish:(NSNotification*)notification;
@end
和回调例程:
private void BardecodeDidFinish(object sender, EventArgs args)
{
}
尽管文档说明应生成名为BarDecodeIDFinishEventArgs的类,但事实并非如此
下面是MonoDevelop在添加库文件后生成的内容
using System;
using MonoTouch.ObjCRuntime;
[assembly: LinkWith ("libbardecode.a", LinkTarget.ArmV6 | LinkTarget.ArmV7 | LinkTarget.Simulator, ForceLoad = true)]
问候
保罗
我正在尝试绑定一个Xcode库,并且正在研究如何绑定。当我尝试访问任何事件或方法时,应用程序崩溃得很厉害
你有关于这些事故的事故报告吗?您是否确切知道哪行托管代码导致崩溃
尽管文档说明应生成名为BarDecodeIDFinishEventArgs的类,但事实并非如此
绑定项目不会生成您将看到的源代码,生成的源代码在编译后会自动删除。您可以在绑定库上运行Reflector,以准确查看生成的内容
using System;
using MonoTouch.ObjCRuntime;
[assembly: LinkWith ("libbardecode.a", LinkTarget.ArmV6 | LinkTarget.ArmV7 | LinkTarget.Simulator, ForceLoad = true)]