xamarin.ios绑定Segment-Analytics错误

时间:2016-08-03 09:49:00

标签: xamarin xamarin.ios xamarin.ios-binding

我正在开发用于细分/分析的iOSbinding,并在此处遇到阻碍。

oc代码我无法找到转换为C#代码的好主意。

-(SEGReachability *)initWithReachabilityRef:(SCNetworkReachabilityRef)ref;

当我将代码转换为以下代码时:

        [Export("initWithReachabilityRef:")]
        unsafe IntPtr Constructor(ref NetworkReachability @ref);

发生错误:

Error CS0311: The type SystemConfiguration.NetworkReachability' cannot be used as type parameterT' in the generic type or method ObjCRuntime.Runtime.GetNSObject<T>(System.IntPtr)'. There is no implicit reference conversion fromSystemConfiguration.NetworkReachability' to `Foundation.NSObject' (CS0311) (Anayltics.IOS)

    [Export ("initWithReachabilityRef:")]
    [CompilerGenerated]
    public SEGReachability (ref SCNetworkReachabilityRef @ref)
        : base (NSObjectFlag.Empty)
    {
        IntPtr @refValue = IntPtr.Zero;

        IsDirectBinding = GetType ().Assembly == global::ApiDefinition.Messaging.this_assembly;
        if (IsDirectBinding) {
            InitializeHandle (global::ApiDefinition.Messaging.IntPtr_objc_msgSend_ref_IntPtr (this.Handle, Selector.GetHandle ("initWithReachabilityRef:"), ref refValue), "initWithReachabilityRef:");
        } else {
            InitializeHandle (global::ApiDefinition.Messaging.IntPtr_objc_msgSendSuper_ref_IntPtr (this.SuperHandle, Selector.GetHandle ("initWithReachabilityRef:"), ref refValue), "initWithReachabilityRef:");
        }

        @ref = @refValue != IntPtr.Zero ? Runtime.GetNSObject<Anayltics.SCNetworkReachabilityRef> (@refValue) : null; //**--**error happened in this line.****
    }

任何人都可以帮助我?

0 个答案:

没有答案