Notes on Apple Core Bluetooth Peripheral ID

  • The only peripheral ID that Core Bluetooth API offers after discovery is CBPeripheral.identifier.
  • Not MAC address.
    You can’t get MAC address via Core Bluetooth. There is no public API for this. If this is an internal or jailbreak application you can get the value of the kLockdownBluetoothAddressKey key via liblockdown.dylib.
  • It’s obtained via callback function didDiscoverPeripheral. (iPhone acts as central device)
  • Type is NSUUID, not CBUUID. UUID is deprecated as of iOS 7.0.
  • identifier has been moved to CBPeer class, which is base class of CBPeripheral. So net effect is the same.
  • A different central will return a different id for the same peripheral.
  • A central will return the same id for a peripheral. Thus, it can be stored and used later per Apple doc.
    However, I don’t know how long it will return the same id.
    Important: assuming the peripheral doesn’t use Bluetooth 4.0 Privacy feature, which changes its ID periodically.
  • Peripheral MAC & central id (& possible time) is used (by Core Bluetooth) in generating this CBPeripheral.identifier.
Notes on Apple Core Bluetooth Peripheral ID

iOS accessory bug:

After extensive testing, I found a big IOS external accessory bug in iOS 5.x.x – 6.1.2 detailed below.
I submitted the bug to Apple and got confirmation that they are aware of it but they can’t share anymore detail. A fix may be in next version! Standard Apple secret procedure.

EAAccessory object returns no protocol string (even with accessory attached) after iPhone wakes
up from deep sleep
Steps to Reproduce:
– Put iPhone with app into sleep for 3 hours (or overnight) by pressing power button.
– Wake up iPhone using home/power button.
– Print out the protocol string as below:
NSArray *accessories = [[EAAccessoryManager sharedAccessoryManager] connectedAccessories];
for (EAAccessory *eaa in accessories) {
NSLog(@”protocol %@”, eaa.protocolStrings);
}
– We tried to put in 6s retry timer but it doesn’t help.

iOS accessory bug:

iOS Dev: applicationWillResignActive & applicationDidEnterBackground events

IOS’s applicationWillResignActive event

IOS’s applicationWillResignActive event is fired when:

  • single click the home button (only if UIApplicationExitsOnSuspend=NO)
  • there is incoming phone call
  • pulling down notification center in IOS 5+
  • double click the home button
  • screen is turned off by auto-lock
  • user turns off via power button
  • SMS message is received in IOS4
  • Alarm-based interruption occurs (displayed in an alert dialog) Notes: Starting IOS 5 with notification center, apps with notifications such as SMS, Calender, Reminders… can be configured to ‘Alert Style’ in Settings \ Notifications. If the app is configured as such, it will cause applicationWillResignActive event to fire when there is a notifition; otherwise, applicationWillResignActive event will not be fired.

Notes: UIApplicationExitsOnSuspend flag does affect the behavior of applicationWillResignActive event.

IOS’s applicationDidEnterBackground event is fired when:

  • single click the home button
  • phone call if user picks up
  • pulling down notification center (IOS 5+) & click on an notification to launch an app
  • double click the home button & select a different app
  • user turns off via power button (only if UIApplicationExitsOnSuspend=NO)
  • screen is turned off by auto-lock (only if UIApplicationExitsOnSuspend=NO)
  • Alarm-based interruption occurs (displayed in an alert dialog) & user chooses reply

Notes: UIApplicationExitsOnSuspend flag does affect the behavior of applicationDidEnterBackground event.

iOS Dev: applicationWillResignActive & applicationDidEnterBackground events

iphone 3.0 dev: Hello World!

I’m late in the iPhone gold rush. Nevertheless, it’s hottest thing right now. So I need to learn it. Here is my journey:

  1. Buy a Macbook Pro with Snow Leopard CD.
  2. Install Snow Leopard.
  3. One nice thing about Snow Leopard CD is that it includes latest Xcode 3.2 in “Optional Installation” directory.
    Install Xcode 3.2.
  4. Download iphone 3.0 SDK for Snow Leopard from http://developer.apple.com/iphone/.
    Install iphone 3.0 SDK.
  5. Download Hello World example from http://developer.apple.com/iphone/.
  6. Run Xcode and open Hello World example project.
iphone 3.0 dev: Hello World!