Inj*_*ios 6 xamarin objective-sharpie
我正在使用sharpie
bind
命令为我的iOS
库获取 API 接口xamarin
sharpie bind --namespace=XXX --sdk=iphoneos9.2 Headers/*.h
Run Code Online (Sandbox Code Playgroud)
@protocol
绑定有问题:
The type or namespace name `IProfileDelegate' could not be found. Are you missing an assembly reference?
Run Code Online (Sandbox Code Playgroud)
这是它的生成方式:
interface XLibrary : IProfileDelegate
{
[Wrap ("WeakProfileDelegate")]
[NullAllowed]
MB_ProfileDelegate ProfileDelegate { get; set; }
Run Code Online (Sandbox Code Playgroud)
我知道它会创建空ProfileDelegate
然后编译器或用方法填充它,但我的问题是IProfileDelegate
没有找到。
@protocol ProfileDelegate <NSObject>
@required
- (void)GetProfileFinished:(NSString*)_data;
- (void)SetProfileFinished:(NSString*)_data;
@end
Run Code Online (Sandbox Code Playgroud)
I
符号的区别(我猜是为@protocols 保留的)。如何sharpie
生成正确的 api 定义?
我能够删除所有I
前缀并成功编译,但我宁愿修复它,以免每次需要更新源库时都重复此操作。
谢谢
小智 5
请记住,所有 obj-c 协议都充当接口或抽象类,我建议将“协议、模型和基本类型设置为 nsobject,将所有方法或属性设为“必需”的另一件事是您需要将其指定为抽象
[Protocol, Model]
[BaseType (typeof(NSObject))]
interface myAwesomeDelegate
{
[Abstract]
[Export(...)]
void myRequiredMethod(uint param1)
[Export(...)]
void anotherMethod()
}
Run Code Online (Sandbox Code Playgroud)
希望这将帮助您解决您的问题
归档时间: |
|
查看次数: |
948 次 |
最近记录: |