【问题标题】:CNSetSupportedSSIDs returning false/ not working correctly?CNSetSupportedSSID 返回错误/无法正常工作?
【发布时间】:2012-01-31 17:39:47
【问题描述】:

我尝试使用 CaptiveNetwork 来替换用于网络用户身份验证的网页。方法是 CNSetSupportedSSIDs。 我尝试添加列表,但每次打开我的应用程序时,用于用户身份验证的网页仍然不断弹出。 我尝试调试它,我意识到我一直将返回值设为 FALSE。

这是我的代码:

-(void)updateSSIDlist

{
[[NSNotificationCenter defaultCenter] postNotificationName:@"ssidInitStarted" object:nil    userInfo:nil];
 ATT_Remote_Access_Wifi_ClientAppDelegate *delegate = (ATT_Remote_Access_Wifi_ClientAppDelegate *)[[UIApplication sharedApplication] delegate];

delegate.ssidInitFinished = NO;
Hotspots *h = [Hotspots defaultHotspots];
NSArray *ssids2 = [h uniqueSSIDs];
NSLog(@"ssids we're shoving down into the system config for iOS to leave alone: %@", [ssids2 description]); 

bool ok = CNSetSupportedSSIDs((CFArrayRef) ssids2);

if(ok)
 {
  [[NSNotificationCenter defaultCenter]   postNotificationName:@"ssidInitCompleted" object:nil userInfo:nil];
NSLog(@"completed");    
}
else
{
 [[NSNotificationCenter defaultCenter] postNotificationName:@"ssidInitFailed" object:nil userInfo:nil];
NSLog(@"failed"); 
}

delegate.ssidInitFinished = YES;
delegate.dbIsBusy = NO;
 }

我搜索了很多,但找不到任何正确的示例或文档。 我也尝试了下面的链接示例,但即使这样也重新调整了相同的结果。

感谢任何帮助!谢谢!

【问题讨论】:

    标签: iphone


    【解决方案1】:
    NSString *values[] = {@"yourssid"};    
    CFArrayRef arrayRef = CFArrayCreate(kCFAllocatorDefault, (void *)values, (CFIndex)1, &kCFTypeArrayCallBacks);    
    if( CNSetSupportedSSIDs(arrayRef))
    {
        NSLog(@"Successfully registered supported network SSIDs");
    }
    else
    {
        NSLog(@"Error: Failed to register supported network SSIDs");
    }
    

    登录页面被阻止,但我的应用程序不会被调用。让我们分享经验。谢谢

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-15
      • 2015-02-15
      • 1970-01-01
      • 2013-06-07
      • 1970-01-01
      相关资源
      最近更新 更多