Note that there are some explanatory texts on larger screens.

plurals
  1. POMonoTouch binding to ObjectiveC library not working
    primarykey
    data
    text
    <p>the .h:</p> <pre><code>#import &lt;Foundation/Foundation.h&gt; typedef enum _XLBadgeManagedType { XLInboxManagedMethod = 0, XLDeveloperManagedMethod = 1 } XLBadgeManagedType ; @interface XLXtifyOptions :NSObject { NSString *xoAppKey; BOOL xoLocationRequired ; BOOL xoBackgroundLocationRequired ; BOOL xoLogging ; BOOL xoMultipleMarkets; XLBadgeManagedType xoManageBadge; } + (XLXtifyOptions *)getXtifyOptions; - (NSString *)getAppKey ; - (BOOL) isLocationRequired; - (BOOL) isBackgroundLocationRequired ; - (BOOL) isLogging ; - (BOOL) isMultipleMarkets; - (XLBadgeManagedType) getManageBadgeType; - (void)xtLogMessage:(NSString *)header content:(NSString *)message, ...; @end </code></pre> <p>the .m:</p> <pre><code>#import "XLXtifyOptions.h" #import "XtifyGlobal.h" static XLXtifyOptions *xXtifyOptions=nil; @implementation XLXtifyOptions + (XLXtifyOptions *)getXtifyOptions { if (xXtifyOptions==nil) { xXtifyOptions=[[XLXtifyOptions alloc]init]; } return xXtifyOptions; } -(id)init { if (self = [super init]) { xoAppKey=xAppKey; xoLocationRequired=xLocationRequired; xoBackgroundLocationRequired=xRunAlsoInBackground ; xoLogging =xLogging ; xoMultipleMarkets=xMultipleMarkets; xoManageBadge=xBadgeManagerMethod; } return self; } - (NSString *)getAppKey { return xoAppKey; } - (BOOL) isLocationRequired { return xoLocationRequired; } - (BOOL) isBackgroundLocationRequired { return xoBackgroundLocationRequired; } - (BOOL) isLogging { return xoLogging; } - (BOOL) isMultipleMarkets { return xoMultipleMarkets; } - (XLBadgeManagedType) getManageBadgeType { return xoManageBadge; } - (void)xtLogMessage:(NSString *)header content:(NSString *)format, ... { va_list args; va_start(args, format); if (xoLogging) { NSString *prettyFmt=[NSString stringWithFormat:@"%@ %@", header,format]; NSLogv(prettyFmt, args); } va_end(args); } @end </code></pre> <p>Global.h:</p> <pre><code>#define xAppKey @"abc123" #define xLocationRequired NO #define xRunAlsoInBackground FALSE #define xBadgeManagerMethod XLInboxManagedMethod #define xLogging TRUE #define xMultipleMarkets FALSE </code></pre> <p>My binding definition:</p> <pre><code>[BaseType (typeof (NSObject))] public interface XLXtifyOptions { [Static] [Export ("xtifyOptions")] XLXtifyOptions Options { get;} [Export ("getAppKey")] string GetAppKey (); [Export ("isLocationRequired")] bool IsLocationRequired (); [Export ("isBackgroundLocationRequired")] bool IsBackgroundLocationRequired (); [Export ("isLogging")] bool IsLogging (); [Export ("isMultipleMarkets")] bool IsMultipleMarkets (); [Export ("getManageBadgeType")] XLBadgeManagedType GetManageBadgeType (); // [Export ("xtLogMessage:content:...")] // void XtLogMessagecontent... (string header, string message,, ); // } </code></pre> <p>These return null:</p> <pre><code>XLXtifyOptions.Options; new XLXtifyOptions().GetAppKey(); </code></pre> <p>The vendors instructions for getting started:</p> <pre><code> XLXtifyOptions *anXtifyOptions=[Options getVendorOptions]; [[TheirClass get ]initilizeXoptions:anVendorOptions]; </code></pre> <p>I hastily tried to rename some things because I'm not sure how much of the vendor's code is ok to paste, so hopefully I didn't confuse matters.</p> <p>This is related to: <a href="https://stackoverflow.com/questions/15350740/binding-define-used-as-constant/15350825?noredirect=1#comment21685459_15350825">Binding #define used as constant</a> </p> <p><strong>MORE INFORMATION:</strong></p> <p>If I run this on a device rather than the simulator, I get the following error:</p> <pre><code>Unhandled managed exception: Wrapper type 'XtifyPush.XLXtifyOptions' is missing its native ObjectiveC class 'XLXtifyOptions'. </code></pre> <p><strong>EDIT</strong></p> <p>re @Stephane: I updated the code to no longer obscure the vendor. What I am binding is: <a href="http://developer.xtify.com/display/sdk/Getting+Started+with+Apple+Push+Notification+Service" rel="nofollow noreferrer">http://developer.xtify.com/display/sdk/Getting+Started+with+Apple+Push+Notification+Service</a>, fwiw. I updated the reference to getXtifyOptions as you recommended, but I have the same result. I got as far as I have with the github library you referenced, but I will keep digging.</p> <p>The binding I am working on is available at: <a href="https://github.com/lordscarlet/monotouch-bindings/tree/master/Xtify" rel="nofollow noreferrer">https://github.com/lordscarlet/monotouch-bindings/tree/master/Xtify</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload