目标Sharpie:生成的(* .g)文件有错误:无法在静态类中声明实例成员(CS0708)

时间:2017-11-01 12:54:48

标签: c# objective-c xamarin.ios twilio objective-sharpie

我确实理解静态类不能声明实例成员,但这是由于生成

而发生的

输入编译器: APIDefinition.cs

// @interface CallKitIntegration (TVOCall)
[Category]
[BaseType(typeof(TVOCall))]
interface TVOCall_CallKitIntegration
{
    // @property (nonatomic, strong) NSUUID * _Nonnull uuid;
    [Export("uuid", ArgumentSemantic.Strong)]
    NSUuid Uuid { get; set; } 

中介编译器输出: TVOCall_CallKitIntegration.g.cs

namespace TwilioVoiceBindingBeta19 {
public unsafe static partial class TVOCall_CallKitIntegration  {

    [CompilerGenerated]
    static readonly IntPtr class_ptr = Class.GetHandle ("TVOCall");

    [CompilerGenerated]
    public virtual NSUuid Uuid {
        [Export ("uuid", ArgumentSemantic.Retain)]
        get {
            NSUuid ret;
            if (IsDirectBinding) {
                ret =  Runtime.GetNSObject<NSUuid> (global::ApiDefinition.Messaging.IntPtr_objc_msgSend (this.Handle, Selector.GetHandle ("uuid")));
            } else {
                ret =  Runtime.GetNSObject<NSUuid> (global::ApiDefinition.Messaging.IntPtr_objc_msgSendSuper (this.SuperHandle, Selector.GetHandle ("uuid")));
            }
            return ret;
        }

enter image description here

APIDefinition有哪些正确的更改可以正确生成g文件?

1 个答案:

答案 0 :(得分:1)

更改为

// @interface CallKitIntegration (TVOCall)
[Category]
[BaseType(typeof(TVOCall))]
interface TVOCall_CallKitIntegration
{
  // @property (nonatomic, strong) NSUUID * _Nonnull uuid;
  [Export("uuid")]
  NSUuid Get_Uuid()

  [Expoer("setuuid:")]
  void Set_Uuid(NSUuid value);