我绑定iOS SDK。但Sharpie
混淆了这个
@interface ALBBQuPaiService : NSObject<ALBBQuPaiService>
最后ALBBQuPaiService
为@protocol ALBBQuPaiService
我试图像这样更改 ApiDefinition 代码:
[Protocol(Name = "ALBBQuPaiService"), Model]
interface ALBBQuPaiServiceProtocol
{
...
}
[BaseType (typeof(NSObject), Name = "ALBBQuPaiService")]
interface ALBBQuPaiService : ALBBQuPaiServiceProtocol
{
// +(instancetype)sharedService;
[Static]
[Export ("sharedService")]
ALBBQuPaiService SharedService ();
// @property (nonatomic, weak) id<QupaiSDKDelegate> _Nullable delegte;
[NullAllowed, Export ("delegte", ArgumentSemantic.Weak)]
QupaiSDKDelegate Delegte { get; set; }
}
最后,我得到了运行时异常:无法识别的选择器发送到实例0x7c73f740
任何人都可以帮助我吗?提前谢谢。
我的SDK link
------------------- 更新1:添加头文件代码 -------------- -----------
#import <Foundation/Foundation.h>
typedef NS_ENUM(NSInteger,QupaiSDKWatermarkPosition){
QupaiSDKWatermarkPositionTopRight,
QupaiSDKWatermarkPositionBottomRight,
};
typedef NS_ENUM(NSInteger,QupaiSDKCameraPosition){
QupaiSDKCameraPositionBack,
QupaiSDKCameraPositionFront,
};
@protocol QupaiSDKDelegate;
@protocol ALBBQuPaiService
-(NSString *) getSdkConfigVersion:(NSString *) platformName
sdkVersion:(NSString *) sdkVersion;
-(void) getSdkConfigVersion:(NSString *) platformName
sdkVersion:(NSString *) sdkVersion
success:(void (^)(NSString *rpcResult))success
failure:(void (^)(NSError *rpcError))failure;
@property (nonatomic, weak) id<QupaiSDKDelegate> delegte;
@property (nonatomic, assign) BOOL enableBeauty;
@property (nonatomic, assign) BOOL enableImport;
@property (nonatomic, assign) BOOL enableMoreMusic;
@property (nonatomic, assign) BOOL enableVideoEffect;
@property (nonatomic, assign) BOOL enableWatermark;
@property (nonatomic, assign) CGFloat thumbnailCompressionQuality;
@property (nonatomic, strong) UIColor *tintColor;
@property (nonatomic, strong) UIImage *watermarkImage;
@property (nonatomic, assign) QupaiSDKWatermarkPosition watermarkPosition;
@property (nonatomic, assign) QupaiSDKCameraPosition cameraPosition;
- (UIViewController *)createRecordViewControllerWithMinDuration: (CGFloat)minDuration
maxDuration:(CGFloat)maxDuration
bitRate:(CGFloat)bitRate;
- (UIViewController *)createRecordViewController;
- (void)updateMoreMusic;
@end
@protocol QupaiSDKDelegate <NSObject>
- (void)qupaiSDK:(id<ALBBQuPaiService>)sdk compeleteVideoPath:(NSString *)videoPath thumbnailPath:(NSString *)thumbnailPath;
@optional
- (NSArray *)qupaiSDKMusics:(id<ALBBQuPaiService>)sdk;
- (void)qupaiSDKShowMoreMusicView:(id<ALBBQuPaiService>)sdk viewController:(UIViewController *)viewController;
@end
@interface ALBBQuPaiService : NSObject<ALBBQuPaiService>
+(instancetype)sharedService;
@property (nonatomic, weak) id<QupaiSDKDelegate> delegte;
@end
答案 0 :(得分:0)
请记住,所有obj-c协议都充当抽象类,我建议将“协议,模型和基本类型设置为nsobject”,另外所有方法或属性都需要将其指定为“必需”摘要
[Protocol, Model]
[BaseType (typeof(NSObject))]
interface myAwesomeDelegate
{
[Abstract]
[Export(...)]
void myRequiredMethod(uint param1)
[Export(...)]
void anotherMethod()
}
我建议使用它支持.framework文件的目标sharpie工具使用版本3.X和命令框架bind -f myFramework.framework 有关它的更多信息,请检查https://developer.xamarin.com/guides/cross-platform/macios/binding/objective-sharpie/tools/或者您也可以查看xamarin Github绑定https://github.com/mono/monotouch-bindings,如果您对绑定有任何具体问题,请告诉我们