How to pin the Public key of a certificate on iOS

In case you are in need of knowing how to extract this information from the certificate in your iOS code, here you have one way to do it. First of all add the security framework. #import <Security/Security.h> The add the openssl libraries. You can download them from https://github.com/st3fan/ios-openssl #import <openssl/x509.h> The NSURLConnectionDelegate Protocol allows you … Read more

How to search an NSSet or NSArray for an object which has an specific value for an specific property?

NSPredicate *predicate = [NSPredicate predicateWithFormat:@”type == %@”, @”standard”]; NSArray *filteredArray = [myArray filteredArrayUsingPredicate:predicate]; id firstFoundObject = nil; firstFoundObject = filteredArray.count > 0 ? filteredArray.firstObject : nil; NB: The notion of the first found object in an NSSet makes no sense since the order of the objects in a set is undefined.

How can I open a Twitter tweet using the native Twitter app on iOS?

This is how you access other apps from your own. Just find the proper url to send for accessing status. I’ve included a list that should have most of the important ones. Including status finding. [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@”twitter://status?id=12345″]]; twitter://user?screen_name=lorenb twitter://user?id=12345 twitter://status?id=12345 twitter://timeline twitter://mentions twitter://messages twitter://list?screen_name=lorenb&slug=abcd twitter://post?message=hello%20world twitter://post?message=hello%20world&in_reply_to_status_id=12345 twitter://search?query=%23hashtag Note: It can be important to … Read more

UISwitch in a UITableView cell

Setting it as the accessoryView is usually the way to go. You can set it up in tableView:cellForRowAtIndexPath: You may want to use target/action to do something when the switch is flipped. Like so: – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { switch( [indexPath row] ) { case MY_SWITCH_CELL: { UITableViewCell *aCell = [tableView dequeueReusableCellWithIdentifier:@”SwitchCell”]; if( … Read more