I adopt my Xcode project with @objc tags so I can use that methods into Xamarin binding. I added .framework as native library to project (also tried to add .a library but I got same problem). I used sharpie bind and created ApiDefinition.cs and Struct.cs, solve all errors there, and when I tried to build it I got a lot of error like:
Error CS0246: The type or namespace name 'PageTracker' could not be found (are you missing a using directive or an assembly reference?) (CS0246) (WebtrekkSDKBinding)
I found that swift code confused Xamarin, because page tracker is defined: @objc
public protocol PageTracker: class. So Xamarin do not have in obj folder PageTracker class, only IPageTracker and PageTrackerWrapper. I don't know how to change Swift code, so it will start working.
Can someone help me?
Thanks in advance.
Hi guys, I found the solution. I was need to change ApiDefiniton.cs file, to be more specific add name from Objective-C runtime.
Into PROJECTNAME-Swift.h which you can be find at PROJECTNAME.framework file. For example I changed this:
[BaseType(typeof(NSObject)] interface MyClass
to:
[BaseType(typeof(NSObject), Name = “_TtC11SwiftSample7MyClass”)] interface MyClass
Answers
Hi guys, I found the solution. I was need to change ApiDefiniton.cs file, to be more specific add name from Objective-C runtime.
Into PROJECTNAME-Swift.h which you can be find at PROJECTNAME.framework file. For example I changed this:
[BaseType(typeof(NSObject)] interface MyClass
to:
[BaseType(typeof(NSObject), Name = “_TtC11SwiftSample7MyClass”)] interface MyClass