简体   繁体   English

iOS 检测 WiFi 热点或蓝牙设备

[英]iOS detect WiFi hotspots or Bluetooth Devices

I know that without users permission trying to switch on WiFi or Bluetooth is not possible (rather comes under private API).我知道未经用户许可尝试打开 WiFi 或蓝牙是不可能的(而是在私有 API 下)。 I dont want to go there.我不想在那里 go 。

Assuming WiFi is switched on or assuming bluetooth is switched on.假设 WiFi 已打开或蓝牙已打开。 Is it possible to detect all Wifi hotspots around my device (iPhone or iPad)?是否可以检测到我的设备(iPhone 或 iPad)周围的所有 Wifi 热点? Same for Bluetooth?蓝牙也一样?

I want to do this in Xcode Version 4.x with iOS SDK 4.3我想在 Xcode 版本 4.x 中使用 iOS SDK 4.3 执行此操作

Update更新
Apple has deprecated a large part of the GameKit peering methods in iOS7. Apple 已弃用 iOS7 中的大部分 GameKit 对等方法。 Added updated information for iOS8.添加了 iOS8 的更新信息。

iOS7 and earlier - GameKit/Wi-Fi; iOS7 及更早版本 - GameKit/Wi-Fi;
The GameKit documentation contains all the information required to set up a peering mechanism using bluetooth The GKPeerPickerController is the most important part for peering. GameKit文档包含使用蓝牙设置对等机制所需的所有信息GKPeerPickerController是对等最重要的部分。

For peering using Wi-Fi;用于使用 Wi-Fi 对等; Apple's Reachability example uses such a mechanism Apple 的Reachability示例使用了这种机制

iOS8 iOS8
In iOS8 Apple has introduced the Multipeer Connectivity Framework .在 iOS8 Apple 引入了多点连接框架 Using this you can start using peering for Wi-Fi, bluetooth and other available services more easily.使用它,您可以更轻松地开始使用对等互连来获得 Wi-Fi、蓝牙和其他可用服务。 For starters you can use the MCNearbyServiceBrowserClass to search for nearby devices and invite users a peer-to-peer session.对于初学者,您可以使用MCNearbyServiceBrowserClass搜索附近的设备并邀请用户点对点 session。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM