I am trying to connect to a Raspberry Pi via iPhone using CoreBluetooth (bluetooth 4.0). I have discovered the device and send out a connection request using this code:
Try out bleno, it's a node.js library that can be used to create a BLE peripheral on both OS X and Linux. It works well on my Raspberry Pi running Raspbian.