.h:
.m:
#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
Global.h:
#define xAppKey @"abc123" #define xLocationRequired NO #define xRunAlsoInBackground FALSE #define xBadgeManagerMethod XLInboxManagedMethod #define xLogging TRUE #define xMultipleMarkets FALSE
My binding definition:
[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 ();
They return null:
XLXtifyOptions.Options; new XLXtifyOptions().GetAppKey();
Instructions for beginners:
XLXtifyOptions *anXtifyOptions=[Options getVendorOptions]; [[TheirClass get ]initilizeXoptions:anVendorOptions];
I hastily tried to rename some things because I'm not sure how much vendor code is approved for insertion, so I hope I haven't confused the questions.
This is due to: #define binding used as constant
ADDITIONAL INFORMATION:
If I run this on the device, and not in the simulator, I get the following error:
Unhandled managed exception: Wrapper type 'XtifyPush.XLXtifyOptions' is missing its native ObjectiveC class 'XLXtifyOptions'.
EDIT
re @Stephane: I updated the code so that I no longer hide the provider. I am required: http://developer.xtify.com/display/sdk/Getting+Started+with+Apple+Push+Notification+Service , fwiw. I updated the link to getXtifyOptions as you recommended, but I have the same result. I got, as far as I know, with the github library that you referenced, but I will continue to dig.
The binding I'm working on is available at: https://github.com/lordscarlet/monotouch-bindings/tree/master/Xtify