gpt4 book ai didi

ios - 迁移到 x64 iOS 后的 Xamarin NetworkReachability SetCallBack 方法问题

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:06:58 26 4
gpt4 key购买 nike

将我的 iOS 项目迁移到 x64 后,我遇到了很多错误,我修复了所有错误,但我无法修复以下错误,我在 Xamarin 和 Apple 开发者网站上搜索了很多,但没有解决。

Error CS1061: Type `SystemConfiguration.NetworkReachability' does not contain a definition for `SetCallback' and no extension method `SetCallback' of type `SystemConfiguration.NetworkReachability' could be found. Are you missing an assembly reference? (CS1061)

我还导入了以下引用资料:

using System;
using System.Net;
using Foundation;
using UIKit;
using SystemConfiguration;
using CoreFoundation;
using CoreServices;

代码是:

NetworkReachability reachability = new NetworkReachability (new IPAddress (new byte [] {169,254,0,0}));
reachability.SetCallback (OnChange); // <-- seems that this method removed from the class But what I should use instead of it ?

请与我分享您的建议。

最佳答案

您需要改用 reachability.SetNotification()

SetCallback() 不再推荐:

[Advice ("Use SetNotification instead")]
public bool SetCallback (NetworkReachability.Notification callback)
{
return this.SetNotification (callback) == StatusCode.OK;
}

关于ios - 迁移到 x64 iOS 后的 Xamarin NetworkReachability SetCallBack 方法问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27669786/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com