【问题标题】:Objective Sharpie: Generated (*.g) files have error: Cannot declare instance members in a static class (CS0708)目标 Sharpie:生成的 (*.g) 文件有错误:无法在静态类中声明实例成员 (CS0708)
【发布时间】:2017-11-01 12:54:47
【问题描述】:

我知道静态类不能声明实例成员,但是这是由于生成了

编译器的输入: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;
        }

对 APIDefinition 进行哪些正确更改会导致正确生成 g 文件?

【问题讨论】:

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


【解决方案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);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-03-19
    • 1970-01-01
    • 2016-06-15
    • 2011-02-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多