Here’s an Objective C method that’ll return a SHA512 hex of a given string: -(NSString*) sha512:(NSString*)input { const char *cstr = [input cStringUsingEncoding:NSUTF8StringEncoding]; NSData *data = [NSData dataWithBytes:cstr length:input.length]; uint8_t digest[CC_SHA512_DIGEST_LENGTH]; CC_SHA512(data.bytes, data.length, digest); NSMutableString* output = [NSMutableString stringWithCapacity:CC_SHA512_DIGEST_LENGTH * 2]; for(int i = 0; i < CC_SHA512_DIGEST_LENGTH; i++) [output appendFormat:@”%02x”, digest[i]]; […]
When using Xcode 4.2 for iOS development there’s an annoying bug where any exceptions crash to the main.m file instead of highlighting the line. Luckily you can set a custom breakpoint to restore the old and correct behaviour: Open the Breakpoint navigator (CMD + 6) Click the + button in the bottom left Select Add Exception Breakpoint Click […]
So many iOS apps developers forget to remove the screenshots from their apps on the App Store; often revealing the horrendous times the screenshots were taken and detracting from the actual app. iTunes Connect recommends the removal of the status bar, and Status Barred removes the status bar perfectly regardless of the screenshot being retina, […]
A great, but underused location feature on iOS is the purpose property of the CLLocationManager. So many apps ask for your location — give your users confidence in sharing their location by telling them why you need it! Example: locationManager.purpose = @“We’ll only use your location to show you local events nearby.”; You need to do […]
When installing or updating Xcode you need to close iTunes for it to complete. If you’ve closed iTunes but still get this message: Open Activity Monitor and quit iTunes Helper. The installation will now finish. This mainly seems to happen on beta versions of iTunes. The helper app runs to detect iOS devices being connected […]
Starting in PhoneGap 0.9.5 there’s an undocumented iOS only feature that allows you to handle whether the device should rotate to a particular orientation. It exposes the iOS Objective-C method shouldAutorotateToInterfaceOrientation with a JavaScript function shouldRotateToOrientation. function shouldRotateToOrientation (rotation) { switch (rotation) { //Portrait or PortraitUpsideDown case 0: case 180: return true; //LandscapeRight or LandscapeLeft case […]
By Ben Collier
|
Posted in iPad, iPhone, Javascript, Mobile, PhoneGap
|
Also tagged Apps, html5, ipad, iPhone, javascript, javascript function, phonegap
|
Usability Cramps [yoo-zuh-bill-ity kramps] n. are unpleasant, often painful sensations caused by unbearable unusable user experience mistakes v. usability cramping, usability cramped, why the hell did they do this? Form Labels That Don’t Select the Fields This one mega-stresses me out; when the text label next to checkbox or a label doesn’t select it when you click it: […]
If you’re trying to find your iOS app screenshots you’ve snapped in Xcode during your app development they’re located here: ~/Library/Application Support/Developer/Shared/Xcode/Screenshots Enjoy all your lovely iPad and iPhone app sn-apps..