【发布时间】:2017-05-18 14:25:34
【问题描述】:
我最近收到了一个我正在尝试绑定的 iOS SDK,以便在我的应用中使用它。 我有 .a 文件,我从中创建 ApiDefinitions.cs 类的 .h 文件,以及所有内容。但是在运行时,无论我试图调用什么方法或属性,我都会收到类似这样的错误 "Neolane_SDK 中的无效 IL 代码:RegisterDevice (Foundation.NSData,string,Foundation.NSDictionary):IL_0043: stloc.s 4"
我知道库本身按预期工作,因为它也用于原生 iOS 应用程序。 我只是想弄清楚我的 Binding 项目配置中缺少什么。
这是与我的 .a 库关联的源 .h 文件:
#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
//the tag id dedicated to the opening of an app following a notification
#define NL_TRACK_CLICK @"2"
@interface Neolane_SDK : NSObject {
}
// marketingHost is the hostname of the Neolane marketing instance (i.e. host.neolane.org)
@property (strong, nonatomic) NSString *marketingHost;
// trackingHost is the hostname of the Neolane tracking instance (i.e. tracking.neolane.org)
@property (strong, nonatomic) NSString *trackingHost;
// integrationKey is the integration key as confgured in your Neolane instance
@property (strong, nonatomic) NSString *integrationKey;
// The connection timout in second (default 30.0 seconds)
@property (nonatomic) double requestTimeout;
// Get the Neolane_SDK instance
+ (Neolane_SDK *) getInstance;
// Register a device in the Neolane instance
// @param token the token as received from the didRegisterForRemoteNotificationsWithDeviceToken callback.
// @param userKey the user identifier
// @param additionalParams custom additional parameters
- (void) registerDevice:(NSData *) token :(NSString *) userKey :(NSDictionary *) additionalParams;
// Notify Neolane of the opening of a push message
// @param deliveryId is the Neolane delivery identifier, as received in the push message
// @param broadlogId is the Neolane broadlog identifier, as received in the push message
// @param tagId tag identifier in Neolane server (NL_TRACK_CLICK when opening an app following a notification).
- (void) track:(NSString *) deliveryId :(NSString *) broadlogId :(NSString *) tagId;
// Send tracking information to Neolane
// @param launchOptions object received by the application before the opening of the application
// @param tagId tag identifier in Neolane server (NL_TRACK_CLICK when opening an app following a notification)
- (void) track:(NSDictionary *) launchOptions :(NSString *) tagId;
void displayOptions(NSDictionary * launchOptions);
@end
这里是用Sharpie创建的C#关联界面:微笑:
// @interface Neolane_SDK : NSObject
[BaseType(typeof(NSObject))]
interface Neolane_SDK
{
// @property (nonatomic, strong) NSString * marketingHost;
[Export("marketingHost", ArgumentSemantic.Strong)]
string MarketingHost { get; set; }
// @property (nonatomic, strong) NSString * trackingHost;
[Export("trackingHost", ArgumentSemantic.Strong)]
string TrackingHost { get; set; }
// @property (nonatomic, strong) NSString * integrationKey;
[Export("integrationKey", ArgumentSemantic.Strong)]
string IntegrationKey { get; set; }
// @property (nonatomic) double requestTimeout;
[Export("requestTimeout")]
double RequestTimeout { get; set; }
// +(Neolane_SDK *)getInstance;
[Static]
[Export("getInstance")]
Neolane_SDK Instance { get; }
// -(void)registerDevice:(NSData *)token :(NSString *)userKey :(NSDictionary *)additionalParams;
[Export("registerDevice:::")]
void RegisterDevice(NSData token, string userKey, NSDictionary additionalParams);
// -(void)track:(NSString *)deliveryId :(NSString *)broadlogId :(NSString *)tagId;
[Export("track:::")]
void Track(string deliveryId, string broadlogId, string tagId);
// -(void)track:(NSDictionary *)launchOptions :(NSString *)tagId;
[Export("track::")]
void Track(NSDictionary launchOptions, string tagId);
}
尽管如此,这是我的 .a 文件的 LinkWith 选项
[assembly: LinkWith("libNeolane_SDK.a", SmartLink = true, ForceLoad = true)]
感谢任何帮助/反馈/经验 :)
谢谢!
【问题讨论】:
标签: xamarin xamarin.ios xamarin.ios-binding