Wireless accessory configuration in iOS: EAWiFiUnconfiguredAccessoryBrowser will detect unconfigured accessories only once

♀尐吖头ヾ 提交于 2019-12-04 02:56:01

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

EAWiFiUnconfiguredAccessoryBrowser has issues,and doesn't provide reliable result in certain use cases. i think you should try this

 - (void) viewWillAppear:(BOOL)animated{
       NSLog(@"view will appear");
       if (_accessories != nil) {
          [_accessories removeAllObjects];
       }

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

below method makes browser object nil and reinitialises it, in this case browser object will always return you updated(i.e, proper) values . it worked perfectly for me.

 -(void) initializeBrowswerAndStartSearch    
 {
       // Make EAWiFiUnconfiguredAccessoryBrowser  object nil and reinitiate ,start searching again 
       _browser = nil;
      _browser = [[EAWiFiUnconfiguredAccessoryBrowser alloc]      initWithDelegate:self queue:nil];
      [_browser startSearchingForUnconfiguredAccessoriesMatchingPredicate:nil];
 }

anytime you feel EAWiFiUnconfiguredAccessoryBrowser isn't providing proper result , try this.

I also have this issue. So I build a singleton called WAC service, then you can keep this singleton alive during the app life cycle. Anywhere you want to load the unconfigured accissories. Just load it from [_browser unconfiguredAccessories].

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!