There's a framework for that: Multipeer Connectivity was introduced in iOS 7 and is pretty much a developer-level version of AirDrop, per the intro to the framework reference:
The Multipeer Connectivity framework provides support for discovering services provided by nearby iOS devices using infrastructure Wi-Fi networks, peer-to-peer Wi-Fi, and Bluetooth personal area networks and subsequently communicating with those services by sending message-based data, streaming data, and resources (such as files).
There's a good overview of how to discover nearby devices running your app and transfer NSData between them in the WWDC 2013 session that introduced the technology, as well as some Apple sample code that shows a complete working example.