iOS中的无线配件配置:EAWiFiUnconfiguredAccessoryBrowser将仅检测未配置的附件一次 [英] Wireless accessory configuration in iOS: EAWiFiUnconfiguredAccessoryBrowser will detect unconfigured accessories only once

查看:956
本文介绍了iOS中的无线配件配置:EAWiFiUnconfiguredAccessoryBrowser将仅检测未配置的附件一次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 EAWiFiUnconfiguredAccessoryBrowser 检测 EAWiFiUnconfiguredAccessory 。开始附件搜索的代码如下:

I am using EAWiFiUnconfiguredAccessoryBrowser to detect EAWiFiUnconfiguredAccessory. The code to start the accessory search it's the following:

- (void)viewDidLoad {
    [super viewDidLoad];

    if (_accessories == nil) {
        _accessories = [[NSMutableArray alloc] init];
    }

    if (_browser == nil) {
        _browser = [[EAWiFiUnconfiguredAccessoryBrowser alloc] initWithDelegate:self queue:nil];
        _browser.delegate = self;
    }
}

不幸的是,负载。如果我回到上一个视图,然后重新加载视图,它不会找到它们。

Unfortunately it does find accessories only the first time the View loads. If I go back to the previous view and then reload the view it does not find them.

我试过:


  • 重新创建浏览器附件并重新启动搜索(无法正常工作)

  • 停止搜索并重新启动(不起作用)

这是我获得的最新代码(请参阅上面的代码):

This is the latest code I got (refer to this together with the code above):

- (void) viewWillAppear:(BOOL)animated{
    NSLog(@"view will appear");

    if (_accessories != nil) {
        [_accessories removeAllObjects];
    }

    [self.tableView reloadData];
    [self initializeBrowswerAndStartSearch];
}

- (void) initializeBrowswerAndStartSearch{
    if (_browser != nil) {
        [_browser stopSearchingForUnconfiguredAccessories];
    }

    [_browser startSearchingForUnconfiguredAccessoriesMatchingPredicate:nil];
}

- (void) viewWillDisappear:(BOOL)animated{
    [_browser stopSearchingForUnconfiguredAccessories];
}

看来附件列表信息是缓存 APP内的某处。如果我重新启动APP,它会找到他们所以我想有一些我缺少的东西。

It seems that the accessory list information is cached somewhere within the APP. If I restart the APP it will find them so I guess there is something that I am missing.

任何帮助?

推荐答案

所以我有同样的问题。你应该使用 unconfiguredAccessories 数组。此外,请尝试保持浏览器的实例。如果您发现设备一次,并重新实例化浏览器,您将无法再找到它。

so i have the same problem..you should use the unconfiguredAccessories array. Also, try keeping the instance of the browser alive. If you discover the device once, and you re-instantiate the browser, you wont find it again

这篇关于iOS中的无线配件配置:EAWiFiUnconfiguredAccessoryBrowser将仅检测未配置的附件一次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆