The app detects a estimote ibeacon when ever the phone is running no matter whether the app is in the foreground/background but when the phone is closed/locked, the app doesn't detect the ibeacons anymore. Can you someone tell me how to fix this
You are using estimote ibeacon, which means you are using CoreLocation Framework, not CoreBluetooth framework.....
As for not detecting when the phone gets locked, detection of Ibeacons in background mode sometimes takes upto 10 mins; So what you can do when defining the CLBeaconRegion is enable it's notifyStateOnEntry, call startMonitoringRegion followed by startRangingBeaconsInRegion