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.
Advertisements
Notes on Apple Core Bluetooth Peripheral ID

git svn broken in OS X Yosemite

Type ‘git svn’ command, you will get the error below:

$ git svn
Can't locate SVN/Core.pm in @INC (you may need to install the SVN::Core module) (@INC contains: /usr/local/git/lib/perl5/site_perl/5.18.2/darwin-thread-multi-2level /usr/local/git/lib/perl5/site_perl/5.18.2 /usr/local/git/lib/perl5/site_perl /Library/Perl/5.18/darwin-thread-multi-2level /Library/Perl/5.18 /Network/Library/Perl/5.18/darwin-thread-multi-2level /Network/Library/Perl/5.18 /Library/Perl/Updates/5.18.2 /System/Library/Perl/5.18/darwin-thread-multi-2level /System/Library/Perl/5.18 /System/Library/Perl/Extras/5.18/darwin-thread-multi-2level /System/Library/Perl/Extras/5.18 .) at /usr/local/git/lib/perl5/site_perl/Git/SVN/Utils.pm line 6.
BEGIN failed--compilation aborted at /usr/local/git/lib/perl5/site_perl/Git/SVN/Utils.pm line 6.
Compilation failed in require at /usr/local/git/lib/perl5/site_perl/Git/SVN.pm line 26.
BEGIN failed--compilation aborted at /usr/local/git/lib/perl5/site_perl/Git/SVN.pm line 33.
Compilation failed in require at /usr/local/git/libexec/git-core/git-svn line 25.
BEGIN failed--compilation aborted at /usr/local/git/libexec/git-core/git-svn line 25.

Solution

The problem is that prerequisite Perl libraries which are missing.
You can use existing Xcode Perl libraries by using the below 2 commands:

$ sudo ln -s /Applications/Xcode.app/Contents/Developer/Library/Perl/5.18/darwin-thread-multi-2level/SVN /System/Library/Perl/Extras/5.18/SVN
$ sudo ln -s /Applications/Xcode.app/Contents/Developer/Library/Perl/5.18/darwin-thread-multi-2level/auto/SVN/ /System/Library/Perl/Extras/5.18/auto/SVN

Notes
– If you have OS X Mavericks, change 5.18 in the above commands to 5.16.
– If you have OS X Mountain Lion, change 5.18 in the above commands to 5.12.
– You must install Xcode Command Line Tools in advance.
– If you don’t run the 2nd command, you will get the error below:
$ git svn
Can't locate loadable object for module SVN::_Core in @INC (@INC contains: /usr/local/git/lib/perl5/site_perl/5.18.2/darwin-thread-multi-2level /usr/local/git/lib/perl5/site_perl/5.18.2 /usr/local/git/lib/perl5/site_perl /Library/Perl/5.18/darwin-thread-multi-2level /Library/Perl/5.18 /Network/Library/Perl/5.18/darwin-thread-multi-2level /Network/Library/Perl/5.18 /Library/Perl/Updates/5.18.2 /System/Library/Perl/5.18/darwin-thread-multi-2level /System/Library/Perl/5.18 /System/Library/Perl/Extras/5.18/darwin-thread-multi-2level /System/Library/Perl/Extras/5.18 .) at /System/Library/Perl/Extras/5.18/SVN/Base.pm line 59.
BEGIN failed--compilation aborted at /System/Library/Perl/Extras/5.18/SVN/Core.pm line 5.
Compilation failed in require at /usr/local/git/lib/perl5/site_perl/Git/SVN/Utils.pm line 6.
BEGIN failed--compilation aborted at /usr/local/git/lib/perl5/site_perl/Git/SVN/Utils.pm line 6.
Compilation failed in require at /usr/local/git/lib/perl5/site_perl/Git/SVN.pm line 26.
BEGIN failed--compilation aborted at /usr/local/git/lib/perl5/site_perl/Git/SVN.pm line 33.
Compilation failed in require at /usr/local/git/libexec/git-core/git-svn line 25.
BEGIN failed--compilation aborted at /usr/local/git/libexec/git-core/git-svn line 25.

– If you don’t want to make symbolic link, you can install using this command:
brew install git svn

git svn broken in OS X Yosemite

Swift programming language disambiguation

Recent Apple’s announcement of new Swift programming language caused confusion among developers. Swift, which should be called Apple Swift, is new programing language from Apple. Other Swift languages are not Apple Swift.

Apple Swift has JavaScript-like syntax and is similar to Rust http://www.rust-lang.org.

Swift programming language disambiguation

Interesting about android NFC whitelist nfcee_access.xml file

Since the wallet only works if its signature is in this whitelist file, we can deduce the business strategy.
Below is the list of app signatures in whitelist nfcee_access.xml file in different popular android phones:

– Nexus S, Nexus 4: Google wallet (of course).
I guess this is only way I get Google Wallet if you have T-Mobile & AT&T.
– Verizon Note 2: VZW ISIS + VZW CERT.
ISIS Wallet only.
– T-Mobile GS4: ISIS development + production.
ISIS Wallet only.
– International GS3: Google wallet + Samsung wallet.
Samsung has its own wallet too.
– Sprint GS3: Google wallet
– Sprint GS4: Google wallet + Sequent Wallet.
Reflecting Sprint new business deal with Sequent.

Interesting about android NFC whitelist nfcee_access.xml file

Xcode Error – Could not launch app – No such file or directory

I got this annoying error with Xcode 4.6.1: Could not launch app – No such file or directory Error.

Xcode was working for me for awhile without problem with my iPhone. A friend wanted me to install an app on his phone. And I got this error.

It turns out that the “Deployment Target” (=IOS 6.0) is higher than that on the phone IOS 5.1.1.

I hope it helps,

Xcode Error – Could not launch app – No such file or directory

iOS console log using ASL

If you want to get iOS console log, you can use below code:

NSMutableArray* mainList = [NSMutableArray array];
aslmsg q, m;
int i;
const char *key, *val;
q = asl_new(ASL_TYPE_QUERY);
aslresponse r = asl_search(NULL, q);
while (NULL != (m = aslresponse_next(r)))
{
    NSMutableDictionary *tmpDict = [NSMutableDictionary dictionary];
    for (i = 0; (NULL != (key = asl_key(m, i))); i++)
    {
        NSString *keyString = [NSString stringWithUTF8String:(char *)key];
        val = asl_get(m, key);
        NSString *string = [NSString stringWithUTF8String:val];
        [tmpDict setObject:string forKey:keyString];
    }
    [mainList addObject:tmpDict];
}
aslresponse_free(r);
iOS console log using ASL