2017-05-18 10 views
2

최근에 내 앱에 사용하기 위해 바인딩하려는 iOS SDK가 수신되었습니다. .a 파일, ApiDefinitions.cs 클래스를 만든 .h 파일이 있고 모든 것이 빌드됩니다. 하지만 런타임에 어떤 메서드 나 속성을 호출하려고해도이 코드와 같은 오류가 발생합니다 "Neolane_SDK에 잘못된 IL 코드가 있습니다. RegisterDevice (Foundation.NSData, string, Foundation.NSDictionary) : IL_0043 : stloc.s 4 "Xamarin.iOS 런타임에 프로젝트 바인딩 오류가 발생했습니다.

네이티브 iOS 응용 프로그램에서도 사용되기 때문에 라이브러리 자체가 예상대로 작동하고 있음을 알고 있습니다. Binding 프로젝트 구성에서 누락 된 부분을 파악하려고합니다.

#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 

을 그리고 여기에 C#을 관련 샤피로 만든 인터페이스 : 미소 : 여기

내 .A 라이브러리와 관련된 .H 파일 소스입니다에도 불구하고

// @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)] 

모든 도움/피드백/경험이 감사합니다 :)

감사합니다.

답변

4

csc (Windows 또는 Mono 5.0 이상을 사용하는 MacOS)을 사용하는 경우 컴파일러 옵션에서 최적화를 설정하십시오. 기본는 해당 옵션 및 생성 된 IL을 사용하지 않는 최적없는 옆에 최적화 바인딩 mtouch을 혼동 할 수 빌드 디버그으로

.

이것은 다음 XI 버전 (10.12)에서 수정 될 예정이지만 바인딩 프로젝트에서 /optimize+을 사용하면 단점이 없습니다 (다시 전환하지 않아도됩니다).

+1

답장을 보내 주셔서 감사합니다. 그거였다 ! – Miiite