I use Xamarin Studio and I write applications for iOs on C#. I need to bind obj C library (libAdWired.a) to C# platform, in order to be able to use it directly from C#. First of all, I have to bind objective-C to C#, so I create a Binding Project in Xamarin. Then I include an objective-C lib to the project (libAdWired.a) and create inside ApiDefenition.cs a binding-code.
namespace Adwired
{
[BaseType (typeof(UIView))]
interface AWView
{
[Export ("delegate", ArgumentSemantic.Assign)]
NSObject Delegate { get; set; }
[Export ("bannerDidStartSelector", ArgumentSemantic.Assign)]
Selector BannerDidStartSelector { get; set; }
[Export ("bannerDidStopSelector", ArgumentSemantic.Assign)]
Selector BannerDidStopSelector { get; set; }
[Export ("bannerDidFailSelector", ArgumentSemantic.Assign)]
Selector BannerDidFailSelector { get; set; }
[Export ("placeId", ArgumentSemantic.Copy)]
string PlaceId { get; set; }
[Export ("keywords", ArgumentSemantic.Copy)]
NSObject [] Keywords { get; set; }
[Export ("bannerType")]
AWBannerType BannerType { get; }
[Export ("closeAnimation")]
AWViewAnimation CloseAnimation { get; set; }
[Export ("frameLocked")]
bool FrameLocked { get; set; }
[Export ("frameLock", ArgumentSemantic.Assign)]
RectangleF FrameLock { get; set; }
[Export ("fullscreenOrientationMask")]
AWBannerOrientation FullscreenOrientationMask { get; set; }
[Static, Export ("debugMode")]
bool DebugMode { set; }
[Static, Export ("isDebugMode")]
bool IsDebugMode { get; }
[Static, Export ("uniqueIdentifier")]
string UniqueIdentifier { get; }
[Static, Export ("uniqueIdentifier2")]
string UniqueIdentifier2 { get; }
[Static, Export ("initialize")]
void Initialize ();
[Export ("initWithDelegate:")]
IntPtr Constructor (NSObject aDelegate);
[Export ("initWithDelegate:rotationEnabled:")]
IntPtr Constructor (NSObject aDelegate, bool rotationEnabled);
[Export ("loadForPlaceId:")]
bool LoadForPlaceId (string placeId);
[Export ("loadForPlaceId:keywords:")]
bool LoadForPlaceId (string placeId, NSObject [] keywords);
[Static, Export ("checkForPlaceId:keywords:")]
bool CheckForPlaceId (string placeId, NSObject [] keywords);
[Export ("changeOrientation:")]
void ChangeOrientation (UIInterfaceOrientation orientation);
[Export ("removeWithAnimation:")]
void RemoveWithAnimation (AWViewAnimation animation);
[Export ("showInView:placeId:")]
void ShowInView (UIView view, string placeId);
[Export ("showInView:placeId:keywords:")]
void ShowInView (UIView view, string placeId, NSObject [] keywords);
[Export ("showBannerOnView:placeId:context:")]
void ShowBannerOnView (UIView baseView, string placeId, string context);
[Export ("hideBanner")]
void HideBanner ();
[Export ("modifyView")]
void ModifyView ();
}
[BaseType (typeof(NSObject))]
[Model]
interface AWDelegate
{
[Export ("bannerDidStart:")]
void BannerDidStart(AWView bannerView);
[Export ("bannerDidStop:")]
void BannerDidStop(AWView bannerView);
[Export ("bannerDidFail:")]
void BannerDidFail(AWView bannerView);
}
public enum AWViewAnimation
{
Undefined = 0,
None,
Simple,
Thin
}
public enum AWBannerType
{
Undefined = 0,
Standart,
Fullscreen,
Slim,
Custom
}
public enum AWBannerOrientation
{
None = 0,
Portrait = 1 << 0,
PortraitUpsideDown = 1 << 1,
LandscapeLeft = 1 << 2,
LandscapeRight = 1 << 3,
OrientationAll = 8
}
}
And finally as output i have a C# binding dll (AdWired.dll).
Then, I add this DLL into my main C# project. i want to use AWView class from this DLL. So i instantiate this class with following code AWView _banner = new AWView(). When I deploy my application to a device i see "Wrapper type 'AdWired.AWView' is missing its native ObjectiveC class 'AWView'".
I tried to find this class in obj C lib, and i found it. However...
I am stuck now, so any help or advice will be appreciated.
PS. Its runtime error.