C# 无法使用NEHotspotConfigurationManager创建热点连接
当我尝试在我的Xamarin.IOS项目中创建热点连接时,在使用NEHotspotConfigurationManager时,在说明中返回以下错误:C# 无法使用NEHotspotConfigurationManager创建热点连接,c#,xamarin.ios,C#,Xamarin.ios,当我尝试在我的Xamarin.IOS项目中创建热点连接时,在使用NEHotspotConfigurationManager时,在说明中返回以下错误: Error-Domain=nehostpointconfigurationerrordomain-code=8\'内部错误。\'用户信息={NSLocalizedDescription=内部错误。} 我尝试连接到办公室的网络和手机的wifi热点,两者都返回相同的消息。我已在开发者门户上的应用程序ID上以及在authorities.plist中启用了
Error-Domain=nehostpointconfigurationerrordomain-code=8\'内部错误。\'用户信息={NSLocalizedDescription=内部错误。}
我尝试连接到办公室的网络和手机的wifi热点,两者都返回相同的消息。我已在开发者门户上的应用程序ID上以及在authorities.plist中启用了“接受WiFi信息”和“热点”选项,但仍然存在相同的错误。我使用的代码如下所示
public async void JoinNetwork()
{
NEHotspotConfiguration config = new NEHotspotConfiguration("CTIP");
config.JoinOnce = false;
var tcs = new TaskCompletionSource<NSError>();
NEHotspotConfigurationManager.SharedManager.ApplyConfiguration(config, err => tcs.SetResult(err));
var error = await tcs.Task;
if (error != null)
{
PAGE.IOSErrorAlert(error.Description, this);
return;
}
}
public async void JoinNetwork()
{
NEHOSTPOTConfiguration=新的NEHOSTPOTConfiguration(“CTIP”);
config.JoinOnce=false;
var tcs=new TaskCompletionSource();
nehospotconfigurationmanager.SharedManager.ApplyConfiguration(config,err=>tcs.SetResult(err));
var error=等待tcs.Task;
if(错误!=null)
{
PAGE.IOSErrorAlert(error.Description,this);
返回;
}
}
尝试按以下方式编写代码
NEHotspotConfiguration config = new NEHotspotConfiguration("CTIP" ,passphrase , false);
config.JoinOnce = true;
var tcs = new TaskCompletionSource<NSError>();
NEHotspotConfigurationManager.SharedManager.ApplyConfiguration(config, err =>
tcs.SetResult(err));
nehostpotconfiguration=newnehostpotconfiguration(“CTIP”,密码短语,false);
config.JoinOnce=true;
var tcs=new TaskCompletionSource();
NEHotspotConfigurationManager.SharedManager.ApplyConfiguration(配置,错误=>
设置结果(错误);
尝试重启你的设备,这似乎是苹果方面的一个已知问题
指
热点不需要密码吗?我想你需要在
nehospotconfiguration
constructor中设置密码。谢谢你的建议,但在更改代码并重新启动设备后,我仍然会得到相同的密码,我也曾在另一台设备上尝试过,以确保不是这样。当然,如果有更新,请随时在此处发布。