Archive for the ‘Apple’ Category

Windows: hold Shift while right clicking in the folder

MAC OS X: System Preferences > Keyboard > Shortcuts > Services: Enable New Terminal at Folder.

This error only came out recently and according to this post in stackoverflow, it seems a bug in Apple.

Thanks for bringing this to the attention of the community and apologies for the issues you’ve been having. This issue stems from having a copy of the expired WWDR Intermediate certificate in both your System and Login keychains. To resolve the issue, you should first download and install the new WWDR intermediate certificate (by double-clicking on the file). Next, in the Keychain Access application, select the System keychain. Make sure to select “Show Expired Certificates” in the View menu and then delete the expired version of the Apple Worldwide Developer Relations Certificate Authority Intermediate certificate (expired on February 14, 2016). Your certificates should now appear as valid in Keychain Access and be available to Xcode for submissions to the App Store.

Following Apple’s instruction, the error is resolved now.

I received this error after a XCode update recently (maybe they are not related).

To fix it, just remove the Apple account and add it again …

My new project requires to share Keychain among containing app and share extension. This requires the support of the keychain access group, which my current wrapper doesn’t support.

The iOS KeychainItemWrapper provided by Apple supports access group, but it doesn’t work in ARC. I found this from github which claims ARCified.

The library is very easy to use, but when i tried to retrieve the stored password, it always gave me NSZeroData. After some research, i found that I need convert NSString to NSData before storing my string data as KSecValueData.

//store value
KeychainItemWrapper *keychain = [[KeychainItemWrapper alloc] initWithIdentifier:KEYCHAIN_NAME accessGroup:KEYCHAIN_GROUP];
[keychain setObject:[password dataUsingEncoding:NSUTF8StringEncoding] forKey:(__bridge id)kSecValueData];

//retrieve stored value
KeychainItemWrapper *keychain = [[KeychainItemWrapper alloc] initWithIdentifier:KEYCHAIN_NAME accessGroup:KEYCHAIN_GROUP];
NSData *mySecureData = [keychain objectForKey:(__bridge id)kSecValueData];
NSString *password = [[NSString alloc] initWithData:mySecureData encoding:NSUTF8StringEncoding];

To keep it simple, one reason could be that you detached the view controller inviewDidLoad, instead ofviewDidAppear.

iOS: convert a HEX color to a UIColor method

Posted: November 17, 2014 in Apple, iOS

The + colorWithRed:green:blue:alpha: method in UIColor requires color parameters as a value from 0.0 to 1.0, instead of the usual Hex or Decimal value.

It will be quite troublesome to convert those values (divide by 255 for each color component). Thanks for this link or, it makes your life much easier by returning the Objective-c UIColor message directly.

iOS Simulator: how to close a app

Posted: November 11, 2014 in Apple