I received recently an iOS SDK that I'm trying to bind, to use it into my app. I have the .a file, the .h file from which I created the ApiDefinitions.cs class, and everything build. But at runtime, whatever method or property I'm trying to call, I get an error like this one "Invalid IL code in Neolane_SDK:RegisterDevice (Foundation.NSData,string,Foundation.NSDictionary): IL_0043: stloc.s 4"
I know that the library itself is working as expected, because it is also used in a native iOS application. I'm just trying to figure out what I'm missing in my Binding project configuration.
Here is the source .h file associated with my .a library:
#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
And here is the C# associated interface created with sharpie :smile:
// @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);
}
Despite that, here is the LinkWith options for my .a file
[assembly: LinkWith("libNeolane_SDK.a", SmartLink = true, ForceLoad = true)]
Any help / feedback / experience is appreciated :)
Thanks !