makerofthings7
makerofthings7

Reputation: 61433

Objective Sharpie: Generated (*.g) files have error: Cannot declare instance members in a static class (CS0708)

I do understand that static classes can't declare instance members, however this is occurring as a result of the generation of the

Input to compiler: 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; } 

Intermediary compiler output: 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

What are the right changes to APIDefinition that result in correct generation of the g files?

Upvotes: 1

Views: 424

Answers (1)

sunyt
sunyt

Reputation: 319

change to this

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

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

Upvotes: 1

Related Questions